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

Added gfx.startFrame and gfx.endFrame

This commit is contained in:
Reuh 2015-08-18 15:40:54 +02:00
parent 0e42f25b8b
commit 2584e46816
2 changed files with 19 additions and 5 deletions

View file

@ -14,8 +14,10 @@ while os.run() do
if keys.held.up then y = y - 1 end
if keys.held.down then y = y + 1 end
gfx.rectangle(x, y, 10, 10)
gfx.rectangle(240, 150, 120, 10)
gfx.startFrame()
gfx.rectangle(x, y, 10, 10)
gfx.rectangle(240, 150, 120, 10)
gfx.endFrame()
gfx.render()
end

View file

@ -5,14 +5,24 @@
u32 defaultColor = RGBA8(255, 255, 255, 255);
static int gfx_render(lua_State *L) {
sf2d_end_frame();
sf2d_swapbuffers();
static int gfx_startFrame(lua_State *L) {
sf2d_start_frame(GFX_TOP, GFX_LEFT);
return 0;
}
static int gfx_endFrame(lua_State *L) {
sf2d_end_frame();
return 0;
}
static int gfx_render(lua_State *L) {
sf2d_swapbuffers();
return 0;
}
static int gfx_rectangle(lua_State *L) {
int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L, 2);
@ -26,6 +36,8 @@ static int gfx_rectangle(lua_State *L) {
}
static const struct luaL_Reg gfx_lib[] = {
{ "startFrame", gfx_startFrame},
{ "endFrame", gfx_endFrame },
{ "render", gfx_render },
{ "rectangle", gfx_rectangle },
{ NULL, NULL }