stars.lua screen does not update int the sim

SDL needs to do lcd_update from the main thread
stars.lua uses an event that runs in a timer thread
so in the sim the screen never updates

Change-Id: I6002525363010c3133ebbfb490763f747c5d773a
This commit is contained in:
William Wilgus 2026-01-12 01:22:07 -05:00
parent 7327d9fb6c
commit 46d644fcd7
2 changed files with 9 additions and 0 deletions

View file

@ -1052,6 +1052,11 @@ LUALIB_API int luaopen_rock(lua_State *L)
{
luaL_register(L, LUA_ROCKLIBNAME, rocklib);
luaL_register(L, LUA_ROCKLIBNAME, rocklib_aux);
#ifdef SIMULATOR /* rb.SIMULATOR = true allows checking for the SIM in lua */
lua_pushboolean(L, 1);
luaS_newlloc(L, "SIMULATOR", TSTR_INBIN);
lua_setfield(L, -2, "SIMULATOR");
#endif
lua_getglobal(L, "require");
lua_pushstring(L, "rb_defines");
if (lua_pcall (L, 1, 0, 0))

View file

@ -414,7 +414,11 @@ action_event(rb.actions.ACTION_NONE) -- we can call this now but not after regis
local eva = rockev.register("action", action_event)
local evc = rockev.register("timer", action_drift, rb.HZ/7)
if not rb.SIMULATOR then
while not action_quit() do rb.sleep(rb.HZ) end
else -- the SIM requires lcd_update to be called from the main thread
while not action_quit() do _lcd:update(); rb.sleep(10) end
end
if start_x and start_y then
file = io.open(fname, "w")