mirror of
https://github.com/SleepingInsomniac/pixelfaucet
synced 2025-01-08 05:24:20 +01:00
Change from *
to #splat
This commit is contained in:
parent
0eb0eb2449
commit
5fc507fbaf
3 changed files with 5 additions and 6 deletions
|
@ -156,6 +156,5 @@ class ThreeDee < PF::Game
|
|||
end
|
||||
end
|
||||
|
||||
# engine = ThreeDee.new(256, 240, 4)
|
||||
engine = ThreeDee.new(256 * 2, 240 * 2, 2)
|
||||
engine = ThreeDee.new(640, 480, 2)
|
||||
engine.run!
|
||||
|
|
|
@ -14,11 +14,11 @@ module PF
|
|||
macro [](*args)
|
||||
# width and height are the isqrt of args.size
|
||||
{% if args.size == 4 %}
|
||||
PF::Matrix(typeof({{*args}}), 4).new(2, 2, StaticArray[{{*args}}])
|
||||
PF::Matrix(typeof({{args.splat}}), 4).new(2, 2, StaticArray[{{args.splat}}])
|
||||
{% elsif args.size == 9 %}
|
||||
PF::Matrix(typeof({{*args}}), 9).new(3, 3, StaticArray[{{*args}}])
|
||||
PF::Matrix(typeof({{args.splat}}), 9).new(3, 3, StaticArray[{{args.splat}}])
|
||||
{% elsif args.size == 16 %}
|
||||
PF::Matrix(typeof({{*args}}), 16).new(4, 4, StaticArray[{{*args}}])
|
||||
PF::Matrix(typeof({{args.splat}}), 16).new(4, 4, StaticArray[{{args.splat}}])
|
||||
{% else %}
|
||||
raise "Cannot determine width and height of matrix with {{ args.size }} elements, " \
|
||||
"please provide them explicitly Matrix(Int32, 16).new(4, 4, StaticArray[...])"
|
||||
|
|
|
@ -8,7 +8,7 @@ module PF
|
|||
# PF::Vector[1, 2] # => PF::Vector2(Int32)(@x=1, @y=2)
|
||||
# ```
|
||||
macro [](*args)
|
||||
PF::Vector{{args.size}}(typeof({{*args}})).new(
|
||||
PF::Vector{{args.size}}(typeof({{args.splat}})).new(
|
||||
{% for arg in args %}
|
||||
{{ arg }},
|
||||
{% end %}
|
||||
|
|
Loading…
Reference in a new issue