1
0
Fork 0
mirror of https://github.com/ctruLua/ctruLua.git synced 2025-10-28 08:49:30 +00:00

Added the 3D effect

Works nice, but can burn your eyes.
Warning: the example can actually burn your eyes.
This commit is contained in:
Firew0lf 2015-08-20 01:26:21 +02:00
parent 1c92eb22c3
commit 58309b39c2
2 changed files with 26 additions and 2 deletions

View file

@ -1,12 +1,15 @@
local gfx = require("ctr.gfx")
local hid = require("ctr.hid")
local ctr = require("ctr")
local x = 0
local y = 0
local d = 4
local angle = 0
gfx.color.setBackground(gfx.color.RGBA8(200, 200, 200))
gfx.set3D(true)
while os.run() do
local keys = hid.keys()
@ -17,8 +20,11 @@ while os.run() do
if keys.held.left then x = x - 1 end
if keys.held.up then y = y - 1 end
if keys.held.down then y = y + 1 end
if keys.held.cstickUp then d = d + 1 end
if keys.held.cstickDown then d = d - 1 end
gfx.startFrame(gfx.GFX_TOP)
gfx.startFrame(gfx.GFX_TOP, gfx.GFX_LEFT)
gfx.color.setDefault(0xFF0000FF)
gfx.rectangle(x, y, 10, 10, angle)
@ -33,12 +39,19 @@ while os.run() do
gfx.circle(125, 125, 16)
gfx.endFrame()
gfx.startFrame(gfx.GFX_TOP, gfx.GFX_RIGHT)
gfx.circle(125+d, 125, 16)
gfx.endFrame()
gfx.startFrame(gfx.GFX_BOTTOM)
gfx.color.setDefault(0, 0, 0)
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())
gfx.endFrame()