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:
@@ -14,6 +14,9 @@ function init()
|
||||
game.vars.radius = 10
|
||||
game.vars.frame_count = 0
|
||||
|
||||
-- Enable continuous frame updates for smooth animation
|
||||
game.set_frame_updates(true)
|
||||
|
||||
print("Bouncing Ball initialized")
|
||||
end
|
||||
|
||||
@@ -28,8 +31,8 @@ function update(event)
|
||||
return true
|
||||
end
|
||||
|
||||
-- Update physics if running
|
||||
if game.vars.state == STATE_RUNNING then
|
||||
-- Update physics if running (on any frame tick)
|
||||
if event.type == INPUT.FRAME_TICK and game.vars.state == STATE_RUNNING then
|
||||
-- Move ball
|
||||
game.vars.ball_x = game.vars.ball_x + game.vars.vel_x
|
||||
game.vars.ball_y = game.vars.ball_y + game.vars.vel_y
|
||||
|
||||
Reference in New Issue
Block a user