function love.load() logging = true loveMemUsage = collectgarbage("count") loveInitLog = "love: "..loveMemUsage.." kB, time: "..os.clock().." seconds" arrow = 0 menu_type = "no" debug = false debug_collision = false editor_mode = false textScale = 1 love.graphics.setColor(1,1,1) love.keyboard.setKeyRepeat(true) love.graphics.setDefaultFilter("nearest") -- good pixel game = { secondsSinceStart = 0, scale = 2, width = love.graphics.getWidth(), height = love.graphics.getHeight(), framerate = 60 } require "code/require" fps_history = AvgQueue:New(30,60) logPrint(loveInitLog) loveInitLog = nil Camera.width = game.width Camera.height = game.height levelList = scandir("./data/levels") levelNum = 1 currLevel = levelList[levelNum] logPrint("currLevel: "..currLevel) LoadedParticles = {} LevelLoadTiles() language = "ENG" LocaleLoad(language) gravity = 0.14 -- Debug and log stuff memoryUsage, dtcount = 0, 0 logPrint("mothback: "..collectgarbage("count").." kB, Loading time: "..os.clock().." seconds") main_Player = Player:New(75,50) --Kupo:New(100,150) --Kupo:New(300,150) HookAnchor:New(200,89) HookAnchor:New(400,89) Fairy:New(200,88) --CursedBook:New(180,68) --love.audio.play(music.placeholder) end function love.update(dt) -- audio update love.audio.update() -- fps counter fps_current = fps_history:Push(1/dt) current_dt = dt game.secondsSinceStart = game.secondsSinceStart + dt if DemoRecording or DemoPlayback then Demo:Step() end -- things per second dtcount = dtcount + 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")) end logWrite("Second "..secs..": "..memoryUsage.." kB") end --keypressed if Keybind:CheckPressed(Keybind.menu.pause) then if do_pause then do_pause = false else menu_type = "pause" MenuInit(menu_type) end end --MenuStep if menu_type ~= nil then MenuStep(menu_type) end --editor if editor_mode then EditorStep() else GameStep() end end function love.wheelmoved(_, y) if editor_mode then EditorScroll(y) end end function love.draw() if game.width ~= love.graphics.getWidth() or game.height ~= love.graphics.getHeight() then game.width = love.graphics.getWidth() game.height = love.graphics.getHeight() game_resize = true else game_resize = false end if editor_mode then EditorDraw() else GameDraw() end if menu_type ~= nil then MenuDraw(menu_type) end love.graphics.print(game.scale,10,40) if DemoRecording or DemoPlayback then Demo:Draw() end end