This repository was archived by the owner on Feb 28, 2023. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.lua
More file actions
Latest commit
105 lines (84 loc) · 3.16 KB
/
Copy pathmain.lua
File metadata and controls
105 lines (84 loc) · 3.16 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
96
97
98
99
100
101
102
103
104
105
localScreenManager=require('lib.screenmanager.ScreenManager');
-- ------------------------------------------------
-- Local Variables
-- ------------------------------------------------
localshowDebug=false;
-- ------------------------------------------------
-- Local Functions
-- ------------------------------------------------
---
-- Check if the hardware supports certain features.
--
localfunctioncheckSupport()
print("\n---- RENDERER ---- ");
localname, version, vendor, device=love.graphics.getRendererInfo()
print(string.format("Name: %s \nVersion: %s \nVendor: %s \nDevice: %s", name, version, vendor, device));
end
localfunctiondrawStats()
localh=love.graphics.getHeight();
love.graphics.setColor(100, 100, 100, 255);
love.graphics.rectangle('fill', 5, h-185, 200, 200);
love.graphics.setColor(255, 255, 255, 255);
love.graphics.print(string.format("FT: %.3f ms", 1000*love.timer.getAverageDelta()), 10, h-180);
love.graphics.print(string.format("FPS: %.3f fps", love.timer.getFPS()), 10, h-160);
love.graphics.print(string.format("MEM: %.3f kb", collectgarbage("count")), 10, h-140);
localstats=love.graphics.getStats();
love.graphics.print(string.format("Drawcalls: %d", stats.drawcalls), 10, h-120);
love.graphics.print(string.format("Canvas Switches: %d", stats.canvasswitches), 10, h-100);
love.graphics.print(string.format("TextureMemory: %.2f kb", stats.texturememory/1024), 10, h-80);
love.graphics.print(string.format("Images: %d", stats.images), 10, h-60);
love.graphics.print(string.format("Canvases: %d", stats.canvases), 10, h-40);
love.graphics.print(string.format("Fonts: %d", stats.fonts), 10, h-20);
end
-- ------------------------------------------------
-- Callbacks
-- ------------------------------------------------
functionlove.load()
print("===================")
print(string.format("Title: '%s'", getTitle()));
print(string.format("Version: %.4d", getVersion()));
print(string.format("LOVE Version: %d.%d.%d (%s)", love.getVersion()));
print(string.format("Resolution: %dx%d", love.graphics.getDimensions()));
-- Check the user's hardware.
checkSupport();
print("===================")
print(os.date('%c', os.time()));
print("===================")
localscreens= {
main=require('src.screens.MainScreen');
};
ScreenManager.init( screens, 'main' );
end
functionlove.draw()
ScreenManager.draw();
ifshowDebugthen
drawStats();
end
end
functionlove.update(dt)
ScreenManager.update(dt);
end
functionlove.quit(q)
ScreenManager.quit(q);
end
functionlove.keypressed(key)
ifkey=='f1' then
showDebug=notshowDebug;
end
ScreenManager.keypressed(key);
end
functionlove.mousepressed(x, y, b)
ScreenManager.mousepressed(x, y, b);
end
functionlove.mousereleased(x, y, b)
ScreenManager.mousereleased(x, y, b);
end
functionlove.mousemoved(x, y, dx, dy)
ScreenManager.mousemoved(x, y, dx, dy);
end
functionlove.wheelmoved(x, y)
ScreenManager.wheelmoved(x, y);
end
functionlove.directorydropped(path)
ScreenManager.directorydropped(path);
end