AccelerometerBinds.cpp 708 B

1234567891011121314151617181920212223242526272829303132333435
  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. extern Vec3* next_vec3();
  10. //-----------------------------------------------------------------------------
  11. int32_t accelerometer_orientation(lua_State* L)
  12. {
  13. LuaStack stack(L);
  14. Vec3* orientation = next_vec3();
  15. *orientation = device()->accelerometer()->orientation();
  16. stack.push_lightudata(orientation);
  17. return 1;
  18. }
  19. } // extern "C"
  20. //-----------------------------------------------------------------------------
  21. void load_accelerometer(LuaEnvironment& env)
  22. {
  23. env.load_module_function("Accelerometer", "orientation", accelerometer_orientation);
  24. }
  25. } // namespace crown