mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-28 08:49:30 +00:00
Added ctr.hid lib, hid.read() working.
This commit is contained in:
parent
2a85112e92
commit
0e42f25b8b
4 changed files with 109 additions and 4 deletions
|
|
@ -1,7 +1,20 @@
|
|||
local gfx = require("ctr.gfx")
|
||||
local hid = require("ctr.hid")
|
||||
|
||||
local x = 0
|
||||
local y = 0
|
||||
|
||||
while os.run() do
|
||||
gfx.rectangle(10, 10, 56, 120)
|
||||
local keys = hid.read()
|
||||
|
||||
if keys.down.start then return end
|
||||
|
||||
if keys.held.right then x = x + 1 end
|
||||
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
|
||||
|
||||
gfx.rectangle(x, y, 10, 10)
|
||||
gfx.rectangle(240, 150, 120, 10)
|
||||
|
||||
gfx.render()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue