Add frame tick system for continuous animation
- Added INPUT_FRAME_TICK event type to input_event.h - Added wants_frame_updates() virtual method to Game base class - Implemented frame tick logic in main loop (basic1.cpp and emulator/main.cpp) - Added Lua bindings: game.set_frame_updates(bool) and INPUT.FRAME_TICK - Updated LuaGame to support frame updates via registry flag - Updated ball.lua to use continuous frame updates for smooth animation - Both hardware and emulator now support continuous animation for physics/games
This commit is contained in:
@@ -193,6 +193,18 @@ bool LuaGame::wants_to_exit() const {
|
||||
return exit;
|
||||
}
|
||||
|
||||
bool LuaGame::wants_frame_updates() const {
|
||||
if (!L) return false;
|
||||
|
||||
// Check if Lua script wants continuous frame updates
|
||||
lua_pushstring(L, "__wants_frame_updates");
|
||||
lua_gettable(L, LUA_REGISTRYINDEX);
|
||||
bool wants_updates = lua_toboolean(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
return wants_updates;
|
||||
}
|
||||
|
||||
bool LuaGame::call_lua_function(const char* func_name, int nargs, int nresults) {
|
||||
int result = lua_pcall(L, nargs, nresults, 0);
|
||||
if (result != LUA_OK) {
|
||||
|
||||
Reference in New Issue
Block a user