/
game.lua
84 lines (61 loc) · 1.82 KB
/
game.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
local Game = class('Game', Base):include(Stateful)
function Game:initialize(args)
Base.initialize(self)
if args.debug then
love.audio.setVolume(0)
end
local joysticks = love.joystick.getJoysticks()
for i, joystick in ipairs(joysticks) do
if joystick:getName() == "OUYA Game Controller" then
local guid = joystick:getGUID()
love.joystick.setGamepadMapping(guid, "a", "button", 1)
love.joystick.setGamepadMapping(guid, "b", "button", 2)
love.joystick.setGamepadMapping(guid, "x", "button", 3)
love.joystick.setGamepadMapping(guid, "y", "button", 4)
love.joystick.setGamepadMapping(guid, "dpup", "button", 12)
love.joystick.setGamepadMapping(guid, "dpdown", "button", 13)
love.joystick.setGamepadMapping(guid, "dpleft", "button", 14)
love.joystick.setGamepadMapping(guid, "dpright", "button", 15)
love.joystick.setGamepadMapping(guid, "back", "button", 10)
love.joystick.setGamepadMapping(guid, "start", "button", 11)
end
end
self:gotoState("Loading")
end
function Game:update(dt)
end
function Game:draw()
end
function Game:mousepressed(x, y, button)
end
function Game:mousereleased(x, y, button)
end
function Game:keypressed(key, unicode)
end
function Game:keyreleased(key, unicode)
end
function Game:joystickpressed(joystick, button)
end
function Game:joystickreleased(joystick, button)
end
function Game:gamepadaxis(joystick, axis, value)
end
function Game:gamepadpressed(joystick, button)
end
function Game:gamepadreleased(joystick, button)
end
function Game:joystickadded(joystick)
end
function Game:joystickremoved(joystick)
end
function Game:joystickaxis(joystick, axis, value)
end
function Game:joystickhat(joystick, hat, direction)
end
function Game:textinput(text)
end
function Game:focus(has_focus)
end
function Game:quit()
end
return Game