forked from TomK32/Rogue-Beach-CA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.lua
47 lines (40 loc) · 1.1 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
game = {
graphics = {
fullscreen = false,
mode = { height = love.graphics.getHeight(), width = love.graphics.getWidth() }
},
fonts = {},
renderer = require('renderers/ascii'),
sounds = require('sounds'),
realtime = true
}
function game:createFonts(offset)
self.fonts = {
lineHeight = (10 + offset) * 1.7,
small = love.graphics.newFont(12 + offset),
regular = love.graphics.newImageFont('images/font.png', " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&`'*#=[]\""),
large = love.graphics.newFont(24 + offset),
very_large = love.graphics.newFont(48 + offset)
}
end
function game:setMode(mode)
self.graphics.mode = mode
love.graphics.setMode(mode.width, mode.height)
if self.graphics.mode.height < 600 then
self:createFonts(-2)
else
self:createFonts(0)
end
if self.view.updateDisplay then
self.view.updateDisplay()
end
end
function game:startMenu()
game.current_state = StartMenu()
end
function game:start()
game.current_state = MapState()
end
function game:killed(player)
game.current_state = FinishScreen(player)
end