diff options
| author | lstrzebinczyk <[email protected]> | 2017-05-27 20:56:35 +0200 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2017-06-03 20:30:43 -0400 |
| commit | 3a694ffebcff71305d79c6e8c15246d671ce3888 (patch) | |
| tree | 0c5ea151fa8ad76aa2e4feb447d6fe9efef1c409 /test/z_index.rb | |
| parent | 65187cd5126227778146ec33c2857a391fbab620 (diff) | |
| download | ruby2d-3a694ffebcff71305d79c6e8c15246d671ce3888.tar.gz ruby2d-3a694ffebcff71305d79c6e8c15246d671ce3888.zip | |
Use named arguments (#65)
Diffstat (limited to 'test/z_index.rb')
| -rw-r--r-- | test/z_index.rb | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/test/z_index.rb b/test/z_index.rb index e3014f7..887a862 100644 --- a/test/z_index.rb +++ b/test/z_index.rb @@ -23,8 +23,20 @@ class Ruby2D::Square end objects = [] -objects << Square.new(50, 50, 200, "red", @z_index_generator.get) -objects << Square.new(100, 50, 200, "blue", @z_index_generator.get) +objects << Square.new( + x: 50, + y: 50, + size: 200, + color: "red", + z: @z_index_generator.get +) +objects << Square.new( + x: 100, + y: 50, + size: 200, + color: "blue", + z: @z_index_generator.get +) on :mouse_down do |event| x = event.x @@ -39,7 +51,13 @@ on :mouse_down do |event| first_object.z = @z_index_generator.get if first_object when :right # Add new square with z-index of zero, with the middle at mouse position - objects << Square.new(x - 100, y - 100, 200, "random", -objects.count) + objects << Square.new( + x: x - 100, + y: y - 100, + size: 200, + color: "random", + z: -objects.count + ) end end |
