Skip to content

Commit

Permalink
fixed some lacking joystick support. Input should be moved to unified…
Browse files Browse the repository at this point in the history
… keyboard/joy interface instead
  • Loading branch information
SimonLarsen committed Apr 8, 2013
1 parent afb6436 commit e8df460
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
4 changes: 3 additions & 1 deletion highscore_entry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function highscore_entry.keypressed(k, uni)
end
end

function highscore_entry.joystickpressed()
function highscore_entry.joystickpressed(joy, k)
if k == 3 then
if highscore_entry.selection <= 28 then
if highscore_entry.position <= 5 then
Expand All @@ -149,6 +149,8 @@ function highscore_entry.joystickpressed()
else
highscore_entry.confirm()
end
elseif k == 4 then
highscore_entry.delete()
end
end

Expand Down
14 changes: 13 additions & 1 deletion ingame_menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,19 @@ function ingame_menu.keypressed(k, uni)
end

function ingame_menu.joystickpressed(joy, k)

if k == 3 then
if ingame_menu.selection == 1 then
state = STATE_INGAME
playSound("confirm")
elseif ingame_menu.selection == 2 then
mainmenu.enter()
playSound("confirm")
playMusic("opening")
end
elseif k == 4 then
state = STATE_INGAME
playSound("blip")
end
end

function ingame_menu.action(k)
Expand Down
6 changes: 3 additions & 3 deletions mainmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ function mainmenu.joystickpressed(joy, k)
end
end

function mainmenu.action(a)
if a == "down" then
function mainmenu.action(k)
if k == "down" then
selection = wrap(selection + 1, 1,6)
playSound("blip")
elseif a == "up" then
elseif k == "up" then
selection = wrap(selection - 1, 1,6)
playSound("blip")
end
Expand Down
4 changes: 4 additions & 0 deletions options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ function options.joystickpressed(joy, k)
mainmenu.enter()
saveConfig()
end
elseif k == 4 then
playSound("confirm")
mainmenu.enter()
saveConfig()
end
end

Expand Down

0 comments on commit e8df460

Please sign in to comment.