Fix input on linux
This commit is contained in:
@@ -4,7 +4,7 @@ module('scene')
|
||||
module('locale')
|
||||
|
||||
-- Default Input bindings.
|
||||
if PLATFORM == "psp" then
|
||||
if PSP then
|
||||
inputBind("up", INPUT_ACTION_UP)
|
||||
inputBind("down", INPUT_ACTION_DOWN)
|
||||
inputBind("left", INPUT_ACTION_LEFT)
|
||||
@@ -50,6 +50,22 @@ else
|
||||
inputBind("escape", INPUT_ACTION_RAGEQUIT)
|
||||
end
|
||||
|
||||
if INPUT_GAMEPAD then
|
||||
inputBind("gamepad_up", INPUT_ACTION_UP)
|
||||
inputBind("gamepad_down", INPUT_ACTION_DOWN)
|
||||
inputBind("gamepad_left", INPUT_ACTION_LEFT)
|
||||
inputBind("gamepad_right", INPUT_ACTION_RIGHT)
|
||||
|
||||
inputBind("gamepad_a", INPUT_ACTION_ACCEPT)
|
||||
inputBind("gamepad_b", INPUT_ACTION_CANCEL)
|
||||
inputBind("gamepad_back", INPUT_ACTION_RAGEQUIT)
|
||||
|
||||
inputBind("gamepad_lstick_up", INPUT_ACTION_UP)
|
||||
inputBind("gamepad_lstick_down", INPUT_ACTION_DOWN)
|
||||
inputBind("gamepad_lstick_left", INPUT_ACTION_LEFT)
|
||||
inputBind("gamepad_lstick_right", INPUT_ACTION_RIGHT)
|
||||
end
|
||||
|
||||
if INPUT_POINTER then
|
||||
inputBind("mouse_x", INPUT_ACTION_POINTERX)
|
||||
inputBind("mouse_y", INPUT_ACTION_POINTERY)
|
||||
|
||||
@@ -171,12 +171,31 @@ function borderDraw(x, y, innerWidth, innerHeight)
|
||||
)
|
||||
end
|
||||
|
||||
x = 0
|
||||
y = 0
|
||||
|
||||
function sceneDispose()
|
||||
end
|
||||
|
||||
function sceneUpdate()
|
||||
if inputIsDown(INPUT_ACTION_RIGHT) then
|
||||
x = x + 1
|
||||
end
|
||||
|
||||
if inputIsDown(INPUT_ACTION_LEFT) then
|
||||
x = x - 1
|
||||
end
|
||||
|
||||
if inputIsDown(INPUT_ACTION_DOWN) then
|
||||
y = y + 1
|
||||
end
|
||||
|
||||
if inputIsDown(INPUT_ACTION_UP) then
|
||||
y = y - 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function sceneRender()
|
||||
-- Update camera
|
||||
cameraPushMatrix(camera)
|
||||
@@ -185,7 +204,7 @@ function sceneRender()
|
||||
|
||||
spriteBatchPush(
|
||||
nil,
|
||||
0, 0, 32, 32,
|
||||
x, y, x + 32, y + 32,
|
||||
colorBlue()
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user