1
0
Fork 0
mirror of https://github.com/ctruLua/ctruLua.git synced 2025-10-27 16:39:29 +00:00

Improved the gfx.startFrame() function to select a screen, Fixed some values now defined with the C ones

This commit is contained in:
Firew0lf 2015-08-19 01:46:04 +02:00
parent 0c2f641c74
commit b5249e1957
2 changed files with 13 additions and 10 deletions

View file

@ -18,7 +18,7 @@ while os.run() do
if keys.held.up then y = y - 1 end if keys.held.up then y = y - 1 end
if keys.held.down then y = y + 1 end if keys.held.down then y = y + 1 end
gfx.startFrame() gfx.startFrame(gfx.GFX_TOP)
gfx.color.setDefault(0xFF0000FF) gfx.color.setDefault(0xFF0000FF)
gfx.rectangle(x, y, 10, 10, angle) gfx.rectangle(x, y, 10, 10, angle)

View file

@ -8,7 +8,10 @@ int load_color_lib(lua_State *L);
u32 color_default; u32 color_default;
static int gfx_startFrame(lua_State *L) { static int gfx_startFrame(lua_State *L) {
sf2d_start_frame(GFX_TOP, GFX_LEFT); u8 screen = luaL_checkinteger(L, 1);
u8 eye = luaL_optinteger(L, 2, GFX_LEFT);
sf2d_start_frame(screen, eye);
return 0; return 0;
} }
@ -91,14 +94,14 @@ static const struct luaL_Reg gfx_lib[] = {
// constants // constants
struct { char *name; int value; } gfx_constants[] = { struct { char *name; int value; } gfx_constants[] = {
{ "GFX_TOP", 0 }, { "GFX_TOP", GFX_TOP },
{ "GFX_BOTTOM", 1 }, { "GFX_BOTTOM", GFX_BOTTOM },
{ "GFX_LEFT", 0 }, { "GFX_LEFT", GFX_LEFT },
{ "GFX_RIGHT", 1 }, { "GFX_RIGHT", GFX_RIGHT },
{ "TOP_HEIGHT", 240 }, { "TOP_HEIGHT", 240 },
{ "TOP_WIDTH", 400 }, { "TOP_WIDTH", 400 },
{ "BOTTOM_HEIGHT", 240 }, { "BOTTOM_HEIGHT", 240 },
{ "BOTTOM_WIDTH", 320 }, { "BOTTOM_WIDTH", 320 },
{ NULL, 0 } { NULL, 0 }
}; };