-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
95 lines (73 loc) · 1.67 KB
/
main.lua
File metadata and controls
95 lines (73 loc) · 1.67 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
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
85
86
87
88
89
90
91
92
93
94
95
inspect = require "libs.inspect";
tween = require "libs.tween";
local loadAssets = require "src.loader";
require "src.cards";
require "src.utils";
require "src.state.game";
require "src.state.menu";
CScreen = require "libs.cscreen";
math.randomseed(os.time());
settings = {
hotswap = true,
production = true,
};
state = MenuState;
if settings.production then
settings.hotswap = false;
state = MenuState;
end
mouse_x, mouse_y = 0;
function love.load()
CScreen.init(1280, 720, true);
loadAssets();
if state.init then
state:init();
end
music.theme1:play();
end
function love.draw()
CScreen.apply();
if state==GameState then
color(0xea323c);
love.graphics.rectangle("fill", 0, 0, 1280, 720);
else
black();
love.graphics.rectangle("fill", 0, 0, 1280, 720);
end
if state.draw then
state:draw();
end
CScreen.cease();
end
function love.update(dt)
if settings.hotswap then
require("libs.lurker").update();
end
if state.update then
state:update(dt);
end
mouse_x, mouse_y = love.mouse.getPosition();
mouse_x, mouse_y = CScreen.project(mouse_x, mouse_y);
end
function love.keypressed(key)
if key=="`" and not settings.production then
debug.debug();
end
if key=="f12" then
love.graphics.captureScreenshot(os.time()..".png")
end
if key=="escape" then
love.event.quit();
end
if state.keypressed then
state:keypressed(key);
end
end
function love.mousepressed()
if state.mousepressed then
state:mousepressed();
end
end
function love.resize(w, h)
CScreen.update(w, h);
end