-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmain.lua
More file actions
57 lines (43 loc) · 1.28 KB
/
main.lua
File metadata and controls
57 lines (43 loc) · 1.28 KB
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
Key = require("lib.Keyboard")
Tween = require("lib.Tween")
local GPM = require("lib.GamepadMgr")
local SM = require("lib.SceneMgr")
local Event = require("lib.Events")
local sm
local gpm = GPM({"assets/gamecontrollerdb.txt"})
function love.load()
--Love2D game settings
love.graphics.setDefaultFilter('nearest', 'nearest')
local font = love.graphics.newFont("assets/SuperMario256.ttf", 20)
--set the font to the one above
love.graphics.setFont(font)
_G.events = Event(false)
Key:hook_love_events()
gpm.event:hook('controller_added', on_controller_added)
gpm.event:hook('controller_removed', on_controller_removed)
sm = SM("scenes", {"MainMenu", "Test", "TweenTest"})
--sm:switch("MainMenu")
--sm:switch("Test")
sm:switch("TweenTest")
end
function on_controller_added(joyId)
print("controller " .. joyId .. "added")
end
function on_controller_removed(joyId)
print("controller " .. joyId .. "removed")
end
function love.update(dt)
if dt > 0.035 then return end
-- if Key:key_down(",") then
-- sm:switch("MainMenu")
-- elseif Key:key_down(".") then
-- sm:switch("Test")
-- end
sm:update(dt)
Key:update(dt)
gpm:update(dt)
Tween.update(dt)
end
function love.draw()
sm:draw()
end