refactor a bit into pxl8 sys struct
This commit is contained in:
parent
b2682a2d40
commit
f19b06d705
10 changed files with 217 additions and 148 deletions
|
|
@ -80,12 +80,12 @@ static const char* pxl8_ffi_cdefs =
|
|||
"typedef int64_t i64;\n"
|
||||
"typedef float f32;\n"
|
||||
"typedef double f64;\n"
|
||||
"typedef struct pxl8 pxl8;\n"
|
||||
"typedef struct pxl8_gfx pxl8_gfx;\n"
|
||||
"typedef struct pxl8_game pxl8_game;\n"
|
||||
"typedef struct { int x, y, w, h; } pxl8_bounds;\n"
|
||||
"typedef struct { int x, y; } pxl8_point;\n"
|
||||
"\n"
|
||||
"f32 pxl8_game_get_fps(const pxl8_game* game);\n"
|
||||
"f32 pxl8_get_fps(const pxl8* sys);\n"
|
||||
"\n"
|
||||
"i32 pxl8_gfx_get_height(pxl8_gfx* ctx);\n"
|
||||
"i32 pxl8_gfx_get_width(pxl8_gfx* ctx);\n"
|
||||
|
|
@ -451,11 +451,11 @@ void pxl8_script_set_ui(pxl8_script* script, pxl8_ui* ui) {
|
|||
}
|
||||
}
|
||||
|
||||
void pxl8_script_set_game(pxl8_script* script, void* game) {
|
||||
void pxl8_script_set_sys(pxl8_script* script, void* sys) {
|
||||
if (!script) return;
|
||||
if (script->L && game) {
|
||||
lua_pushlightuserdata(script->L, game);
|
||||
lua_setglobal(script->L, "_pxl8_game");
|
||||
if (script->L && sys) {
|
||||
lua_pushlightuserdata(script->L, sys);
|
||||
lua_setglobal(script->L, "_pxl8_sys");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue