mikymod 12 лет назад
Родитель
Сommit
cccef2d5be
1 измененных файлов с 36 добавлено и 0 удалено
  1. 36 0
      src/lua/DeviceBinds.cpp

+ 36 - 0
src/lua/DeviceBinds.cpp

@@ -5,6 +5,40 @@
 namespace crown
 namespace crown
 {
 {
 
 
+//-----------------------------------------------------------------------------
+CE_EXPORT int32_t device_frame_count(lua_State* L)
+{
+	LuaStack stack(L);
+
+	uint64_t frame = device()->frame_count();
+
+	// FIXME: push_int use int32_t, so we need a push_int64,
+	// but i don't know if lua 5.1 supports 64 bit integer
+	stack.push_int(frame);
+
+	return 1;
+}
+
+//-----------------------------------------------------------------------------
+CE_EXPORT int32_t device_last_delta_time(lua_State* L)
+{
+	LuaStack stack(L);
+
+	float delta = device()->last_delta_time();
+
+	stack.push_float(delta);
+
+	return 1;
+}
+
+//-----------------------------------------------------------------------------
+CE_EXPORT int32_t device_start(lua_State* L)
+{
+	device()->start();
+
+	return 0;
+}
+
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 CE_EXPORT int32_t device_stop(lua_State* L)
 CE_EXPORT int32_t device_stop(lua_State* L)
 {
 {
@@ -16,7 +50,9 @@ CE_EXPORT int32_t device_stop(lua_State* L)
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 void load_device(LuaEnvironment& env)
 void load_device(LuaEnvironment& env)
 {
 {
+	env.load_module_function("Device", "start", device_start);
 	env.load_module_function("Device", "stop", device_stop);
 	env.load_module_function("Device", "stop", device_stop);
+	env.load_module_function("Device", "last_delta_time", device_last_delta_time);
 }
 }
 
 
 } // namespace crown
 } // namespace crown