Last active
December 16, 2017 15:07
-
-
Save ryo33/53e5fa48a92d41c4c4446b801c55a4a3 to your computer and use it in GitHub Desktop.
Elixirで作る最高のゲームエンジン ref: https://qiita.com/ryo33/items/7288f5cdfde1c298e1f7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmacro defobject(definition) do | |
quote do | |
json = unquote(definition) |> Poison.encode! |> Poison.decode! | |
case ExJsonSchema.Validator.validate(Zpids.Display.Object.schema, json) do | |
{:error, x} -> | |
raise inspect x | |
_ -> :ok | |
end | |
def definition, do: unquote(definition) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
move_x = case {left, right} do | |
{true, false} -> -1 | |
{false, true} -> 1 | |
_ -> 0 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment