lua_sprite.cpp 741 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
  3. * License: https://github.com/taylor001/crown/blob/master/LICENSE
  4. */
  5. #include "sprite.h"
  6. #include "quaternion.h"
  7. #include "lua_stack.h"
  8. #include "lua_environment.h"
  9. namespace crown
  10. {
  11. static int sprite_set_frame(lua_State* L)
  12. {
  13. LuaStack stack(L);
  14. stack.get_sprite(1)->set_frame(stack.get_int(2));
  15. return 0;
  16. }
  17. static int sprite_set_depth(lua_State* L)
  18. {
  19. LuaStack stack(L);
  20. stack.get_sprite(1)->set_depth(stack.get_int(2));
  21. return 0;
  22. }
  23. void load_sprite(LuaEnvironment& env)
  24. {
  25. env.load_module_function("Sprite", "set_frame", sprite_set_frame);
  26. env.load_module_function("Sprite", "set_depth", sprite_set_depth);
  27. }
  28. } // namespace crown