mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-27 16:39:29 +00:00
Small fix in texture lib, Added a texture in "example.lua"
This commit is contained in:
parent
7896c89e5f
commit
fd885de68a
2 changed files with 7 additions and 1 deletions
|
|
@ -8,6 +8,8 @@ local dMul = 1
|
||||||
|
|
||||||
local angle = 0
|
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.color.setBackground(gfx.color.RGBA8(200, 200, 200))
|
||||||
gfx.set3D(true)
|
gfx.set3D(true)
|
||||||
|
|
||||||
|
|
@ -62,6 +64,8 @@ while ctr.run() do
|
||||||
gfx.text(5, 7, "FPS: "..math.ceil(gfx.getFPS()))
|
gfx.text(5, 7, "FPS: "..math.ceil(gfx.getFPS()))
|
||||||
gfx.text(5, 20, "Hello world, from Lua !", 20)
|
gfx.text(5, 20, "Hello world, from Lua !", 20)
|
||||||
gfx.text(5, 30, "Time: "..os.date())
|
gfx.text(5, 30, "Time: "..os.date())
|
||||||
|
|
||||||
|
texture1:draw(240, 10);
|
||||||
|
|
||||||
local cx, cy = hid.circle()
|
local cx, cy = hid.circle()
|
||||||
gfx.rectangle(40, 90, 60, 60, 0, 0xDDDDDDFF)
|
gfx.rectangle(40, 90, 60, 60, 0, 0xDDDDDDFF)
|
||||||
|
|
@ -74,3 +78,5 @@ while ctr.run() do
|
||||||
|
|
||||||
gfx.render()
|
gfx.render()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
texture1:unload()
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ static int texture_unload(lua_State *L) {
|
||||||
// object
|
// object
|
||||||
static const struct luaL_Reg texture_methods[] = {
|
static const struct luaL_Reg texture_methods[] = {
|
||||||
{"draw", texture_draw },
|
{"draw", texture_draw },
|
||||||
{"destroy", texture_unload},
|
{"unload", texture_unload},
|
||||||
{"__gc", texture_unload},
|
{"__gc", texture_unload},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue