-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.lua
62 lines (50 loc) · 1.41 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
-- libraries
class = require 'libs.middleclass'
vector = require 'libs.vector'
state = require 'libs.state'
tween = require 'libs.tween'
fx = require 'libs.fx'
require 'libs.generalmath'
require 'libs.util'
-- gamestates
require 'states.init'
-- entities
require 'entities.init'
function love.load()
love.window.setTitle(config.windowTitle)
love.window.setIcon(love.image.newImageData(config.windowIcon))
love.graphics.setDefaultFilter(config.filterModeMin, config.filterModeMax, config.anisotropy)
love.graphics.setFont(font[14])
math.randomseed(os.time()/10)
love.keyboard.setKeyRepeat(true)
local loadedOptions = options:load()
if not loadedOptions then
love.window.setMode(1024, 768, {fullscreen = false}) -- default
end
the = {}
the.player = nil
the.system = nil
the.economy = Economy:new()
state.registerEvents()
state.switch(menu)
end
function love.update(dt)
tween.update(dt)
end
function love.keypressed(key, isrepeat)
if not isrepeat then
-- takes a screenshot and saves it
if key == "f12" then
if not love.filesystem.exists("screenshots") then
love.filesystem.createDirectory("screenshots")
end
files = love.filesystem.getDirectoryItems("screenshots")
screenshotNum = #files + 1
screenshot = love.graphics.newScreenshot()
screenshot:encode("screenshots/screenshot"..screenshotNum..".png")
end
end
end
function love.draw()
fx.draw()
end