Skip to content

Commit 420d2cb

Browse files
committed
Fix syntax after breaking change
crystal-lang/crystal#1640
1 parent af86723 commit 420d2cb

20 files changed

+1214
-1214
lines changed

examples/diagnostics.cr

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ def test_mouse()
7676
shape.fill_color = SF.color(255, 128, 0)
7777

7878
buttons = {
79-
SF::Mouse::Left => {-0.7, -0.7}
80-
SF::Mouse::Right => {0.7, -0.7}
81-
SF::Mouse::Middle => {0, -1}
82-
SF::Mouse::XButton1 => {-1, 0}
83-
SF::Mouse::XButton2 => {1, 0}
79+
SF::Mouse::Left => {-0.7, -0.7},
80+
SF::Mouse::Right => {0.7, -0.7},
81+
SF::Mouse::Middle => {0, -1},
82+
SF::Mouse::XButton1 => {-1, 0},
83+
SF::Mouse::XButton2 => {1, 0},
8484
}
8585
buttons.each do |btn, delta|
8686
if SF::Mouse.is_button_pressed(btn)
@@ -131,14 +131,14 @@ def test_controller()
131131
text.color = SF.color(0, 0, 0)
132132

133133
button_pos = [
134-
{5 + 0, 1}
135-
{5 + 1, 0}
136-
{5 - 1, 0}
137-
{5 + 0, -1}
138-
{-5, -3}, {5, -3}
139-
{-2, -0.5}, {2, -0.5}
140-
{0, 0}
141-
{-2.5, 2}, {2.5, 2}
134+
{5 + 0, 1},
135+
{5 + 1, 0},
136+
{5 - 1, 0},
137+
{5 + 0, -1},
138+
{-5, -3}, {5, -3},
139+
{-2, -0.5}, {2, -0.5},
140+
{0, 0},
141+
{-2.5, 2}, {2.5, 2},
142142
]
143143
(0...SF::Joystick.get_button_count(js)).each do |btn|
144144
text.string = (btn+1).to_s
@@ -161,10 +161,10 @@ def test_controller()
161161
shape.fill_color = SF.color(128, 0, 255)
162162

163163
axis_pos = [
164-
{-2.5, 2, :h}, {-2.5, 2, :v}
165-
{-5, -4.5, :v}, {5, -4.5, :v}
166-
{2.5, 2, :h}, {2.5, 2, :v}
167-
{-5, 0, :h}, {-5, 0, :v}
164+
{-2.5, 2, :h}, {-2.5, 2, :v},
165+
{-5, -4.5, :v}, {5, -4.5, :v},
166+
{2.5, 2, :h}, {2.5, 2, :v},
167+
{-5, 0, :h}, {-5, 0, :v},
168168
]
169169
axi = 0
170170
axis_pos.group_by { |a| {a[0], a[1]} } .each do |delta, group|
@@ -207,7 +207,7 @@ class Button < SF::RectangleShape
207207
@text.position = SF.vector2((width - @text.global_bounds.width) / 2, -height / 20)
208208
end
209209

210-
def draw(target, states: SF::RenderStates)
210+
def draw(target, states : SF::RenderStates)
211211
states.transform.combine(transform)
212212

213213
super(target, states)
@@ -220,10 +220,10 @@ h = 50
220220
x = 200
221221
y = 25
222222
actions = {
223-
Button.new("Mouse", w, h) => -> { test_mouse }
224-
Button.new("Controller", w, h) => -> { test_controller }
225-
Button.new("Fullscreen modes", w, h) => -> { display_fullscreen_modes }
226-
Button.new("Audio devices", w, h) => -> { display_audio_devices }
223+
Button.new("Mouse", w, h) => -> { test_mouse },
224+
Button.new("Controller", w, h) => -> { test_controller },
225+
Button.new("Fullscreen modes", w, h) => -> { display_fullscreen_modes },
226+
Button.new("Audio devices", w, h) => -> { display_audio_devices },
227227
}
228228

229229
actions.each_key do |btn|
@@ -251,4 +251,4 @@ while $window.open?
251251
$window.draw(btn)
252252
end
253253
$window.display()
254-
end
254+
end

examples/snakes.cr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ class Snake
6565
end
6666
end
6767

68-
def collides?(other: self)
68+
def collides?(other : self)
6969
other.body.any? { |part| @body[0] == part }
7070
end
7171

72-
def collides?(food: Food)
72+
def collides?(food : Food)
7373
@body[0] == food.position
7474
end
7575

@@ -227,4 +227,4 @@ while window.open?
227227
window.draw field, states
228228

229229
window.display()
230-
end
230+
end

examples/transformable.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Logo
1515
@text.origin = SF.vector2(bounds.width / 2, bounds.height * 0.8)
1616
end
1717

18-
def draw(target, states: SF::RenderStates)
18+
def draw(target, states : SF::RenderStates)
1919
states.transform.combine(transform)
2020
target.draw(@shape, states)
2121
target.draw(@text, states)

generate/generate.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def handle_struct(name, items):
214214
rt = 'Char'
215215
elif rt=='UInt32' and n=='attributeFlags':
216216
rt = 'ContextAttribute'
217-
lib(' {}{}: {}'.format(rename_identifier(n), special, rt))
217+
lib(' {}{} : {}'.format(rename_identifier(n), special, rt))
218218

219219
if special:
220220
if name and name not in objs[cmodule]:
@@ -245,7 +245,7 @@ def handle_union(name, items):
245245

246246
for t, n in items:
247247
t = rename_type(t)
248-
lib(' {}: {}'.format(rename_identifier(n), t))
248+
lib(' {} : {}'.format(rename_identifier(n), t))
249249
lib('end')
250250

251251
if d: obj(name+'ALIAS', d)
@@ -364,7 +364,7 @@ def handle_function(main, params, alias=None):
364364
#if rtype.startswith('ptr ') or rtype=='pointer':
365365
#public = False
366366
aparams.append((rname, rrtype))
367-
sparams = ', '.join('{}: {}'.format(*p) for p in aparams)
367+
sparams = ', '.join('{} : {}'.format(*p) for p in aparams)
368368

369369
d = None
370370
if alias:
@@ -449,7 +449,7 @@ def handle_function(main, params, alias=None):
449449
).format(n).splitlines()
450450
t = None
451451
oparams[i] = (n, t)
452-
sparams = ', '.join(n.split(', ')[0] + ((': '+t) if t else '') for n, t in oparams)
452+
sparams = ', '.join(n.split(', ')[0] + ((' : '+t) if t else '') for n, t in oparams)
453453
if not getter: sparams = '('+sparams+')'
454454
for i, (n, t) in enumerate(oparams):
455455
if n in const and t is None:

src/audio.cr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module SF
2424
extend self
2525

2626
class Sound
27-
def initialize(buffer: SoundBuffer)
27+
def initialize(buffer : SoundBuffer)
2828
initialize()
2929
self.buffer = buffer
3030
end
@@ -65,12 +65,12 @@ module SF
6565

6666
class SoundStream
6767
abstract def on_get_data(): Slice(Int16)
68-
abstract def on_seek(position: Time): Void
68+
abstract def on_seek(position : Time): Void
6969

7070
# :nodoc:
7171
alias FuncBox = Box({(CSFML::SoundStreamChunk* -> CSFML::Bool), (Time -> Nil)})
7272

73-
def initialize(channel_count: Int, sample_rate: Int)
73+
def initialize(channel_count : Int, sample_rate : Int)
7474
@owned = true
7575
@funcs = FuncBox.box({
7676
->(data: CSFML::SoundStreamChunk*) {
@@ -92,7 +92,7 @@ module SF
9292

9393
class SoundRecorder
9494
abstract def on_start(): Bool
95-
abstract def on_process_samples(samples: Slice(Int16)): Bool
95+
abstract def on_process_samples(samples : Slice(Int16)): Bool
9696
abstract def on_stop(): Void
9797

9898
# :nodoc:

0 commit comments

Comments
 (0)