Core Native GBA 0.0.17
create your own game-engine with just lua for nitendo game boy advance console.
Loading...
Searching...
No Matches
runtime.c
Go to the documentation of this file.
1#include "zeebo.h"
2
3/**
4 * @todo remove
5 */
6#include <nds.h>
7
8#define FPS_DELTA (16u)
9
10void runtime(lua_State* L)
11{
12 lua_getglobal(L, "native_callback_loop");
13 int native_callback_loop = luaL_ref(L, LUA_REGISTRYINDEX);
14
15 lua_getglobal(L, "native_callback_draw");
16 int native_callback_draw = luaL_ref(L, LUA_REGISTRYINDEX);
17
18 lua_getglobal(L, "native_callback_keyboard");
19 int native_callback_keyboard = luaL_ref(L, LUA_REGISTRYINDEX);
20
21 static uint8_t page = 0;
22 static uint8_t frameskip = 0;
23
24 while (1) {
25 keys_callback_update(L, native_callback_keyboard);
26 loop_callback_update(L, native_callback_loop, FPS_DELTA);
27 draw_queue_page(page++);
28 draw_callback_update(L, native_callback_draw);
29 draw_cmd_mode(0, 1, 0, 1);
30 draw_queue_burn(page++);
31 draw_cmd_mode(0, 0, 0, 1);
32 draw_queue_burn(page++);
33 swiWaitForVBlank();
34 }
35}
void draw_callback_update(lua_State *L, int callback)
Definition draw.c:98
void draw_cmd_mode(uint8_t drawmode, uint8_t flushmode, uint8_t change_mode, uint8_t change_flush)
Definition draw_color.c:40
void draw_queue_burn(uint8_t page)
Definition draw_queue.c:50
void draw_queue_page(uint8_t page)
Definition draw_queue.c:36
void keys_callback_update(lua_State *L, int callback)
Definition keys.c:31
void loop_callback_update(lua_State *L, int callback, uint8_t dt)
Definition loop.c:3
#define FPS_DELTA
Definition runtime.c:8
void runtime(lua_State *L)
Definition runtime.c:10