lua_color4.cpp 750 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
  3. * License: https://github.com/taylor001/crown/blob/master/LICENSE
  4. */
  5. #include "quaternion.h"
  6. #include "lua_stack.h"
  7. #include "lua_environment.h"
  8. namespace crown
  9. {
  10. static int color4_new(lua_State* L)
  11. {
  12. LuaStack stack(L);
  13. stack.push_quaternion(Quaternion(stack.get_float(1),
  14. stack.get_float(2),
  15. stack.get_float(3),
  16. stack.get_float(4)));
  17. return 1;
  18. }
  19. static int color4_ctor(lua_State* L)
  20. {
  21. LuaStack stack(L);
  22. stack.remove(1); // Remove table
  23. return color4_new(L);
  24. }
  25. void load_color4(LuaEnvironment& env)
  26. {
  27. env.load_module_function("Color4", "new", color4_new);
  28. env.load_module_constructor("Color4", color4_ctor);
  29. }
  30. } // namespace crown