1
0
Fork 0
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:
Reuh 2015-08-18 14:52:20 +02:00
parent 2a85112e92
commit 0e42f25b8b
4 changed files with 109 additions and 4 deletions

View file

@ -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()