diff --git a/sdcard/3ds/ctruLua/editor/main.lua b/sdcard/3ds/ctruLua/editor/main.lua index 26709b4..6f2ed5f 100644 --- a/sdcard/3ds/ctruLua/editor/main.lua +++ b/sdcard/3ds/ctruLua/editor/main.lua @@ -86,20 +86,20 @@ while ctr.run() do if not file then local t = os.time() repeat - gfx.startFrame(gfx.GFX_TOP) + gfx.start(gfx.GFX_TOP) gfx.text(3, 3, "Can't open file in write mode") - gfx.endFrame() + gfx.stop() gfx.render() until t + 5 < os.time() else for i = 1, #lines, 1 do file:write(lines[i]..lineEnding) - gfx.startFrame(gfx.GFX_TOP) + gfx.start(gfx.GFX_TOP) gfx.rectangle(0, 0, math.ceil(i/#lines*gfx.TOP_WIDTH), gfx.TOP_HEIGHT, 0, 0xFFFFFFFF) gfx.color.setDefault(color.background) gfx.text(gfx.TOP_WIDTH/2, gfx.TOP_HEIGHT/2, math.ceil(i/#lines*100).."%") gfx.color.setDefault(color.default) - gfx.endFrame() + gfx.stop() gfx.render() end file:flush() @@ -138,7 +138,7 @@ while ctr.run() do end -- Draw - gfx.startFrame(gfx.GFX_TOP) + gfx.start(gfx.GFX_TOP) -- Lines local sI = math.floor(scrollY / lineHeight) @@ -167,15 +167,15 @@ while ctr.run() do gfx.rectangle(-scrollX+ font:width(displayedText(curline:sub(1, (utf8.offset(curline, cursorX) or 0)-1))), -scrollY+ (cursorY-1)*lineHeight, 1, lineHeight, 0, color.cursor) - gfx.endFrame() + gfx.stop() - gfx.startFrame(gfx.GFX_BOTTOM) + gfx.start(gfx.GFX_BOTTOM) gfx.text(3, 3, "FPS: "..math.ceil(gfx.getFPS())) keyboard.draw(5, 115) - gfx.endFrame() + gfx.stop() gfx.render() end diff --git a/sdcard/3ds/ctruLua/examples/example.lua b/sdcard/3ds/ctruLua/examples/example.lua index 9f5fc28..b9f0089 100644 --- a/sdcard/3ds/ctruLua/examples/example.lua +++ b/sdcard/3ds/ctruLua/examples/example.lua @@ -47,19 +47,19 @@ while ctr.run() do dMul = hid.pos3d() - gfx.startFrame(gfx.GFX_TOP, gfx.GFX_LEFT) + gfx.start(gfx.GFX_TOP, gfx.GFX_LEFT) drawStuffIn3D(-1) - gfx.endFrame() + gfx.stop() - gfx.startFrame(gfx.GFX_TOP, gfx.GFX_RIGHT) + gfx.start(gfx.GFX_TOP, gfx.GFX_RIGHT) drawStuffIn3D(1) - gfx.endFrame() + gfx.stop() - gfx.startFrame(gfx.GFX_BOTTOM) + gfx.start(gfx.GFX_BOTTOM) gfx.color.setDefault(gfx.color.RGBA8(0, 0, 0)) gfx.text(5, 5, "FPS: "..math.ceil(gfx.getFPS())) @@ -72,7 +72,7 @@ while ctr.run() do gfx.rectangle(40, 90, 60, 60, 0, 0xDDDDDDFF) gfx.circle(70 + math.ceil(cx/156 * 30), 120 - math.ceil(cy/156 * 30), 10, 0xFF000000) - gfx.endFrame() + gfx.stop() angle = angle + 0.05 if angle > 2*math.pi then angle = angle - 2*math.pi end diff --git a/sdcard/3ds/ctruLua/libs/openfile.lua b/sdcard/3ds/ctruLua/libs/openfile.lua index c08b842..8954558 100644 --- a/sdcard/3ds/ctruLua/libs/openfile.lua +++ b/sdcard/3ds/ctruLua/libs/openfile.lua @@ -98,7 +98,7 @@ return function(title, curdir, exts, type) end -- Draw - gfx.startFrame(gfx.GFX_TOP) + gfx.start(gfx.GFX_TOP) gfx.rectangle(0, 10+(sel-scroll)*15, gfx.TOP_WIDTH, 15, 0, gfx.color.RGBA8(0, 0, 200)) @@ -112,9 +112,9 @@ return function(title, curdir, exts, type) gfx.rectangle(0, 0, gfx.TOP_WIDTH, 25, 0, gfx.color.RGBA8(200, 200, 200)) gfx.text(3, 3, curdir, 13, gfx.color.RGBA8(0, 0, 0)) - gfx.endFrame() + gfx.stop() - gfx.startFrame(gfx.GFX_BOTTOM) + gfx.start(gfx.GFX_BOTTOM) gfx.text(5, 5, title) gfx.text(5, 20, "Accepted file extensions: "..(exts or "all")) @@ -124,7 +124,7 @@ return function(title, curdir, exts, type) keyboard.draw(5, 115) end - gfx.endFrame() + gfx.stop() gfx.render() end diff --git a/sdcard/3ds/ctruLua/main.lua b/sdcard/3ds/ctruLua/main.lua index 05160d6..4b9540d 100644 --- a/sdcard/3ds/ctruLua/main.lua +++ b/sdcard/3ds/ctruLua/main.lua @@ -23,9 +23,9 @@ repeat while true do hid.read() if hid.keys().down.start then break end - gfx.startFrame(gfx.GFX_TOP) + gfx.start(gfx.TOP) gfx.wrappedText(0, 0, err, gfx.TOP_WIDTH) - gfx.endFrame() + gfx.stop() gfx.render() end end diff --git a/sdcard/3ds/ctruLua/tests/audio/main.lua b/sdcard/3ds/ctruLua/tests/audio/main.lua index 169c09c..af7c43f 100644 --- a/sdcard/3ds/ctruLua/tests/audio/main.lua +++ b/sdcard/3ds/ctruLua/tests/audio/main.lua @@ -40,11 +40,11 @@ while true do audio.mix(nil, leftBalance, 1-leftBalance) end - gfx.startFrame(gfx.GFX_TOP) + gfx.start(gfx.GFX_TOP) gfx.text(5, 5, "Audio test! "..tostring(test:time()).."/"..tostring(test:duration()).."s") gfx.text(5, 25, "Last audio played on channel "..tostring(channel)) gfx.text(5, 65, "Speed: "..(speed*100).."% - Left balance: "..(leftBalance*100).."%") - gfx.endFrame() + gfx.stop() gfx.render() end diff --git a/sdcard/3ds/ctruLua/tests/httpc.lua b/sdcard/3ds/ctruLua/tests/httpc.lua index f7d707b..791bed8 100644 --- a/sdcard/3ds/ctruLua/tests/httpc.lua +++ b/sdcard/3ds/ctruLua/tests/httpc.lua @@ -25,9 +25,9 @@ while ctr.run() do data = (data.."!") end - gfx.startFrame(gfx.GFX_TOP) + gfx.start(gfx.GFX_TOP) gfx.text(0, 0, data) - gfx.endFrame() + gfx.stop() gfx.render() end diff --git a/source/gfx.c b/source/gfx.c index 49c8195..c60686e 100644 --- a/source/gfx.c +++ b/source/gfx.c @@ -52,11 +52,11 @@ void load_map_lib(lua_State *L); /*** Start drawing to a screen. Must be called before any draw operation. -@function startFrame +@function start @tparam number screen the screen to draw to (`GFX_TOP` or `GFX_BOTTOM`) @tparam[opt=GFX_LEFT] number eye the eye to draw to (`GFX_LEFT` or `GFX_RIGHT`) */ -static int gfx_startFrame(lua_State *L) { +static int gfx_start(lua_State *L) { u8 screen = luaL_checkinteger(L, 1); u8 eye = luaL_optinteger(L, 2, GFX_LEFT); @@ -68,9 +68,9 @@ static int gfx_startFrame(lua_State *L) { /*** End drawing to a screen. Must be called after your draw operations. -@function endFrame +@function stop */ -static int gfx_endFrame(lua_State *L) { +static int gfx_stop(lua_State *L) { sf2d_end_frame(); return 0; @@ -358,8 +358,8 @@ static int gfx_calcBoundingBox(lua_State *L) { // Functions static const struct luaL_Reg gfx_lib[] = { - { "startFrame", gfx_startFrame }, - { "endFrame", gfx_endFrame }, + { "start", gfx_start }, + { "stop", gfx_stop }, { "render", gfx_render }, { "getFPS", gfx_getFPS }, { "set3D", gfx_set3D },