-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
114 lines (98 loc) · 3.48 KB
/
main.lua
File metadata and controls
114 lines (98 loc) · 3.48 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
106
107
108
109
110
111
112
113
114
love.filesystem.load("src/Components/Initialization/Run.lua")()
love.filesystem.load("src/Components/Initialization/ErrorHandler.lua")()
function love.initialize(args)
fontcache = require 'src.Components.Modules.System.FontCache'
Presence = require 'src.Components.Modules.API.Presence'
GameColors = require 'src.Components.Modules.Utils.GameColors'
LanguageController = require 'src.Components.Modules.System.LanguageManager'
connectGJ = require 'src.Components.Modules.API.InitializeGJ'
fontcache.init()
gameslot = neuron.new("game")
gameslot.save.game = {
user = {
settings = {
shaders = true,
language = "English",
gamejolt = {
username = "",
usertoken = ""
},
},
game = {
totalPoints = 0,
},
achievments = {},
}
}
gameslot:initialize()
love.graphics.setDefaultFilter("nearest", "nearest")
languageService = LanguageController(gameslot.save.game.user.settings.language)
registers = {
user = {
roundStarted = false,
paused = false,
},
system = {
showDebugHitbox = false,
gameTime = 0,
editor = {
fileDialogOpen = false,
fileDialogSave = false,
metaDataWindow = false,
addNewColorChannel = false,
newColorChannelTag = "",
colorChannelColorPicker = false,
colorChannelCreateCurrentColor = {1, 1, 1, 1},
editColorChannelPicker = false,
currentKey = 0,
currentSelectedLevelID = 0,
saveName = "",
useCustomSongFlag = false,
}
}
}
local gitStuff = require 'src.Components.Initialization.GitStuff'
connectGJ()
if not love.filesystem.isFused() then
gitStuff.getAll()
if love.filesystem.getInfo(".commitid") then
local title = love.window.getTitle()
love.window.setTitle(title .. " | " .. love.filesystem.read(".commitid"))
end
end
local states = love.filesystem.getDirectoryItems("src/States")
for s = 1, #states, 1 do
require("src.States." .. states[s]:gsub(".lua", ""))
end
if DEBUG_APP then
love.filesystem.createDirectory("screenshots")
end
love.filesystem.createDirectory("user")
love.filesystem.createDirectory("user/editor")
love.filesystem.createDirectory("user/saved")
love.filesystem.createDirectory("user/songs")
gamestate.registerEvents()
gamestate.switch(EditorState)
end
function love.update(elapsed)
if gamejolt.isLoggedIn then
registers.system.gameTime = registers.system.gameTime + elapsed
if math.floor(registers.system.gameTime) >= 20 then
gamejolt.pingSession(true)
registers.system.gameTime = 0
io.printf(string.format("{bgGreen}{brightWhite}{bold}[Gamejolt]{reset}{brightWhite} : Client heartbeated a session (%s, %s){reset}\n", gamejolt.username, gamejolt.userToken))
end
end
end
function love.keypressed(k)
if DEBUG_APP then
if k == "f11" then
love.graphics.captureScreenshot("screenshots/screen_" .. os.date("%Y-%m-%d %H-%M-%S") .. ".png")
end
end
end
function love.quit()
if gamejolt.isLoggedIn then
gamejolt.closeSession()
end
end