naming conventions act 2: the end

This commit is contained in:
lustlion
2022-03-06 09:35:45 +01:00
parent edd064c2fd
commit 05bf757ea5
29 changed files with 509 additions and 536 deletions

View File

@@ -1,15 +1,16 @@
function love.load()
logging = true
loveMemUsage = collectgarbage("count")
loveInitLog = "love: "..loveMemUsage.." kB, time: "..os.clock().." seconds"
arrow = 0
local love_mem_usage = collectgarbage("count")
local love_init_log = "love: "..love_mem_usage.." kB, time: "..os.clock().." seconds"
secs = 0
menu_type = "no"
debug = false
debug_collision = false
editor_mode = false
textScale = 1
text_size = 1
love.graphics.setColor(1,1,1)
@@ -17,7 +18,7 @@ function love.load()
love.graphics.setDefaultFilter("nearest") -- good pixel
game = {
secondsSinceStart = 0,
seconds_since_start = 0,
scale = 2,
width = love.graphics.getWidth(),
height = love.graphics.getHeight(),
@@ -29,28 +30,28 @@ function love.load()
fps_history = AvgQueue:new(30,60)
logPrint(loveInitLog)
loveInitLog = nil
logPrint(love_init_log)
love_init_log = nil
Camera.width = game.width
Camera.height = game.height
levelList = scandir("./data/levels")
levelNum = 1
currLevel = levelList[levelNum]
logPrint("currLevel: "..currLevel)
LoadedParticles = {}
LevelLoadTiles()
level_list = scandir("./data/levels")
level_current_num = 1
level_current = level_list[level_current_num]
logPrint("level_current: "..level_current)
loadLevelTiles()
language = "ENG"
LocaleLoad(language)
loadLocale(language)
gravity = 0.14
-- Debug and log stuff
memoryUsage, dtcount = 0, 0
memory_usage, dtcount = 0, 0
logPrint("mothback: "..collectgarbage("count").." kB, Loading time: "..os.clock().." seconds")
main_Player = Player:new(75,50)
main_player = Player:new(75,50)
--Kupo:new(100,150)
--Kupo:new(300,150)
@@ -78,28 +79,28 @@ function love.update(dt)
-- audio update
love.audio.update()
-- fps counter
fps_current = fps_history:Push(1/dt)
fps_current = fps_history:push(1/dt)
current_dt = dt
game.secondsSinceStart = game.secondsSinceStart + dt
game.seconds_since_start = game.seconds_since_start + dt
if DemoRecording or DemoPlayback then Demo:step() end
-- things per second
dtcount = dtcount + dt
game.seconds_since_start = game.seconds_since_start + dt
if dtcount >= 1 then
if secs == nil then secs = 0 end
secs = secs + 1
dtcount = dtcount - 1
if debug or logging then
memoryUsage = math.floor(collectgarbage("count"))
memory_usage = math.floor(collectgarbage("count"))
end
logWrite("Second "..secs..": "..memoryUsage.." kB")
logWrite("Second "..secs..": "..memory_usage.." kB")
end
if Prompt.active_prompt then
-- try to stop the keypress that closed the menu from spilling into the rest of the game
Keybind:CheckPressed(Keybind.menu.pause)
Keybind:checkPressed(Keybind.menu.pause)
if Prompt.active_prompt.closing then
Prompt.active_prompt = nil
else
@@ -107,7 +108,7 @@ function love.update(dt)
end
return
end
if love.keyboard.isDown("f7") then
local test_prompt = Prompt:new({
name = "test prompt",
@@ -119,17 +120,17 @@ function love.update(dt)
end
--keypressed
if Keybind:CheckPressed(Keybind.menu.pause) then
if Keybind:checkPressed(Keybind.menu.pause) then
if do_pause then
do_pause = false
else
menu_type = "pause"
MenuInit(menu_type)
initMenu(menu_type)
end
end
--MenuStep
if menu_type ~= nil then MenuStep(menu_type) end
if menu_type ~= nil then stepMenu(menu_type) end
--editor
if editor_mode then
@@ -161,12 +162,12 @@ function love.draw()
drawGame()
end
if menu_type ~= nil then MenuDraw(menu_type) end
if menu_type ~= nil then drawMenu(menu_type) end
love.graphics.print(game.scale,10,40)
if DemoRecording or DemoPlayback then Demo:draw() end
if Prompt.active_prompt then
Prompt.active_prompt:draw()
end