-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
78 lines (66 loc) · 2.15 KB
/
main.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
--[[
Final project for GD50
When code is supplied from external sources, this is noted.
Structure based off code from the GD50 class.
Description: The idea of the game is a platformer/explorer in which you need
to collect some things in order to "win". The catch of this game is that
there are two hues which dictate the world: light and dark.
When in light mode (the start), you can only interact with light things.
When in dark mode, you can only interact with dark things.
You need to switch between light and dark in order to progress.
]]
love.graphics.setDefaultFilter('nearest', 'nearest')
require 'src/Dependencies'
function love.load()
love.window.setTitle('Dinocolorus')
love.window.setMode(gGameWidth, gGameHeight, {
fullscreen = false,
resizable = true,
})
-- iniitialize (true)
resetKeysMouse(true)
-- initialize music
gSounds['background']:setLooping(true)
gSounds['background']:setVolume(0.5)
gSounds['background']:play()
-- Start our scene manager
SceneManager:init({
['start'] = {name = 'StartScene'; default = true},
['mainmenu'] = {name = 'MainMenuScene'},
['char'] = {name = 'CharSelectScene'},
['play'] = {name = 'PlayScene'},
},{
['pause'] = {name = 'PauseOverlay'},
['dialogue'] = {name = 'DialogueOverlay'},
['text'] = {name = 'TextOverlay'},
['quit'] = {name = 'QuitOverlay'}
})
end
function love.resize(w, h)
gGameWidth = w
gGameHeight = h
end
function love.update(dt)
love.mouse.curCoords.x, love.mouse.curCoords.y = love.mouse.getPosition()
SceneManager:update(dt)
-- reset keys and mouse (don't initialize)
resetKeysMouse(false)
end
function love.draw()
-- push:start()
SceneManager:render()
displayFPS()
-- push:finish()
end
--[[
Renders the current FPS.
]]
function displayFPS()
if DEBUG then
-- simple FPS display across all states
love.graphics.setFont(gFonts['default'])
love.graphics.setColor(0, 1, 0, 1)
love.graphics.print('FPS: ' .. tostring(love.timer.getFPS()), 5, 5)
ResetColor()
end
end