From fd885de68a56d4aa7736b73127f9796f28173b01 Mon Sep 17 00:00:00 2001 From: Firew0lf Date: Fri, 21 Aug 2015 12:48:20 +0200 Subject: [PATCH] Small fix in texture lib, Added a texture in "example.lua" --- sdcard/3ds/ctruLua/example.lua | 6 ++++++ source/texture.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sdcard/3ds/ctruLua/example.lua b/sdcard/3ds/ctruLua/example.lua index 4738c1d..1908502 100644 --- a/sdcard/3ds/ctruLua/example.lua +++ b/sdcard/3ds/ctruLua/example.lua @@ -8,6 +8,8 @@ local dMul = 1 local angle = 0 +local texture1 = gfx.texture.load("sdmc:/3ds/ctruLua/icon.png", gfx.texture.TYPE_PNG); + gfx.color.setBackground(gfx.color.RGBA8(200, 200, 200)) gfx.set3D(true) @@ -62,6 +64,8 @@ while ctr.run() do gfx.text(5, 7, "FPS: "..math.ceil(gfx.getFPS())) gfx.text(5, 20, "Hello world, from Lua !", 20) gfx.text(5, 30, "Time: "..os.date()) + + texture1:draw(240, 10); local cx, cy = hid.circle() gfx.rectangle(40, 90, 60, 60, 0, 0xDDDDDDFF) @@ -74,3 +78,5 @@ while ctr.run() do gfx.render() end + +texture1:unload() diff --git a/source/texture.c b/source/texture.c index b7e2862..fbe8c01 100644 --- a/source/texture.c +++ b/source/texture.c @@ -64,7 +64,7 @@ static int texture_unload(lua_State *L) { // object static const struct luaL_Reg texture_methods[] = { {"draw", texture_draw }, - {"destroy", texture_unload}, + {"unload", texture_unload}, {"__gc", texture_unload}, {NULL, NULL} };