Skip to content

Instantly share code, notes, and snippets.

@ryo33
Last active December 16, 2017 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryo33/53e5fa48a92d41c4c4446b801c55a4a3 to your computer and use it in GitHub Desktop.
Save ryo33/53e5fa48a92d41c4c4446b801c55a4a3 to your computer and use it in GitHub Desktop.
Elixirで作る最高のゲームエンジン ref: https://qiita.com/ryo33/items/7288f5cdfde1c298e1f7
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
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