2
0

AccelerometerBinds.cpp 675 B

123456789101112131415161718192021222324252627282930313233
  1. #include "LuaStack.h"
  2. #include "Device.h"
  3. #include "LuaEnvironment.h"
  4. #include "Accelerometer.h"
  5. namespace crown
  6. {
  7. extern "C"
  8. {
  9. //-----------------------------------------------------------------------------
  10. int32_t accelerometer_orientation(lua_State* L)
  11. {
  12. LuaStack stack(L);
  13. Vec3* orientation = next_vec3();
  14. *orientation = device()->accelerometer()->orientation();
  15. stack.push_vec3(orientation);
  16. return 1;
  17. }
  18. } // extern "C"
  19. //-----------------------------------------------------------------------------
  20. void load_accelerometer(LuaEnvironment& env)
  21. {
  22. env.load_module_function("Accelerometer", "orientation", accelerometer_orientation);
  23. }
  24. } // namespace crown