Código: Seleccionar todo
InitGFX(720,480)
initPads(7)
setsixaxis(0,1)
textures = { }
table.insert(textures, 1, surface())
textures[1]:LoadIMG("helloworld.bmp")
screenW, screenH = screenRes()
tex1x, tex1y = textures[1]:getRes()
cx = (screenW/2)
cy = (screenH/2)
dx = 7
dy = 5
function translate()
DrawText((screenH/2), 450, "Hello, World! Directly on screen")
textures[1]:setRectPos(((screenW-tex1x)/2), ((screenH-tex1y)/2))
DrawText((tex1x/2), (tex1y/2), "Hello, World! on a surface", textures[1])
end
function ReadKeys()
local textx = 100
local texty = 20
DrawText(textx, texty, string.format("Left JoyX: %i -- Left JoyY: %i", LanalogX(0), LanalogY(0)))
texty = texty+20
DrawText(textx, texty, string.format("Right JoyX: %i -- Right JoyY: %i", RanalogX(0), RanalogY(0)))
texty = texty+20
DrawText(textx, texty, string.format("Xaxis: %f Yaxis: %f Zaxis: %f Gaxis: %f", Xaxis(0), Yaxis(0), Zaxis(0), Gaxis(0)))
if up(0) >= 1 then
texty = texty+20
DrawText(textx, texty, "Pressed Up")
end
if down(0) >= 1 then
texty = texty+20
DrawText(textx, texty, "Pressed Down")
end
if left(0) >= 1 then
texty = texty+20
DrawText(textx, texty, "Pressed Left")
end
if right(0) >= 1 then
texty = texty+20
DrawText(textx, texty, "Pressed Right")
end
if R1(0) >= 1 then
texty = texty+20
DrawText(textx, texty, "Pressed R1")
end
if R2(0) >= 1 then
texty = texty+20
DrawText(textx, texty, "Pressed R2")
end
if R3(0) >= 1 then
texty = texty+20
DrawText(textx, texty, "Pressed R3")
end
if L1(0) >= 1 then
texty = texty+20
DrawText(textx, texty, "Pressed L1")
end
if L2(0) >= 1 then
texty = texty+20
DrawText(textx, texty, "Pressed L2")
end
if L3(0) >= 1 then
texty = texty+20
DrawText(textx, texty, "Pressed L3")
end
end
while true do
beginGFX()
translate()
cx = cx+dx
cy = cy+dy
if cx<0 or cx>screenW then dx=(dx-(dx*2)) end
if cy<0 or cy>screenH then dy=(dy-(dy*2)) end
BlitToScreen(textures[1])
ReadKeys()
DrawCircle(cx, cy, (math.sqrt(cx)+math.sqrt(cy)), 255, 255, 255, 1000)
if cross(0) >= 1 then break end
if start(0) >= 1 then Screenshot("test.bmp") end
endGFX()
end