diff --git a/src/gamestates/game.lua b/src/gamestates/game.lua index 04487a3..a8c76ea 100644 --- a/src/gamestates/game.lua +++ b/src/gamestates/game.lua @@ -73,10 +73,7 @@ function game:enter(previous, settings, gameControls, gamejoltSession) boxColumns = math.floor(screenWidth / boxSize) - 1 boxRows = math.floor(screenHeight / boxSize) - 5 -- save the settings for later use - if settings then - gameSettings = settings - end - --gameSettings = settings or gameSettings + gameSettings = settings or gameSettings controls = gameControls or controls session = gamejoltSession -- ping our active state immediately diff --git a/src/gamestates/menu.lua b/src/gamestates/menu.lua index e495dc0..31133ca 100644 --- a/src/gamestates/menu.lua +++ b/src/gamestates/menu.lua @@ -120,7 +120,7 @@ end function menu:mousepressed(x, y, button) if input(button, controls.select) then - Gamestate.switch(game, difficulty, controls, session) + Gamestate.switch(game, {boxSize = settings.difficulty.boxSize, colorStep = settings.difficulty.colorStep, timeLimit = settings.difficulty.timeLimit}, controls) end end diff --git a/src/main.lua b/src/main.lua index b5e3d65..879ee41 100644 --- a/src/main.lua +++ b/src/main.lua @@ -5,31 +5,29 @@ debug = require "conf" -- a bit redundant but makes it obvious what is global local startDate = os.date("*t", os.time()) local logFile = "logs/" .. startDate.year .. "." .. startDate.month .. "." .. startDate.day .. "-" .. startDate.hour .. "." .. startDate.min .. ".log" function log(...) - ---[[ + --[[ local strings = "" if type(arg) == "table" then - for _,v in ipairs(arg) do - strings = strings .. v - end - else - strings = arg - end - -- make sure logs exists - if love.filesystem.exists("logs") then - if not love.filesystem.isDirectory("logs") then - love.filesystem.remove() - love.filesystem.createDirectory("logs") - end - else - love.filesystem.createDirectory("logs") - end - -- append new data to logFile - local success, errorMsg = love.filesystem.append(logFile, strings) - if not success then - print("Failed to write to log file.", errorMsg) - end - --]] - if debug then print(...) end + for _,v in pairs(arg) do + strings = strings .. v +end +else +strings = arg +end +if love.filesystem.exists("logs") then +if not love.filesystem.isDirectory("logs") then +love.filesystem.remove() +love.filesystem.createDirectory("logs") +end +else +love.filesystem.createDirectory("logs") +end +local success, errorMsg = love.filesystem.append(logFile, strings) +if not success then +print("Failed to write to log file.", errorMsg) +end +--]] +if debug then print(...) end end local inifile = require "lib.inifile" @@ -38,15 +36,14 @@ local menu = require "gamestates.menu" function love.load() log("Loading...") - love.window.setIcon(love.image.newImageData("icon.png")) + -- set custom window icon + local icon = love.image.newImageData("icon.png") + love.window.setIcon(icon) log("Window icon set.") -- initialize Game Jolt - if GameJolt.init(48728, "b8e4a0eae1509d3edef3d8451bae1842") then - log("Game Jolt initialized.") - else - log("Err: Game Jolt NOT initialized.") - end + local initSuccess = GameJolt.init(48728, "b8e4a0eae1509d3edef3d8451bae1842") + if initSuccess then log("Game Jolt initialized.") end -- load settings and change if needed local gamejoltSessionOpen = false --set true if we get a session open