This commit is contained in:
Paul Liverman
2015-02-12 14:31:10 -08:00
parent 0af2ac1869
commit f8820e8037
3 changed files with 34 additions and 28 deletions

View File

@@ -73,7 +73,10 @@ function game:enter(previous, settings, gameControls, gamejoltSession)
boxColumns = math.floor(screenWidth / boxSize) - 1 boxColumns = math.floor(screenWidth / boxSize) - 1
boxRows = math.floor(screenHeight / boxSize) - 5 boxRows = math.floor(screenHeight / boxSize) - 5
-- save the settings for later use -- save the settings for later use
gameSettings = settings or gameSettings if settings then
gameSettings = settings
end
--gameSettings = settings or gameSettings
controls = gameControls or controls controls = gameControls or controls
session = gamejoltSession session = gamejoltSession
-- ping our active state immediately -- ping our active state immediately

View File

@@ -120,7 +120,7 @@ end
function menu:mousepressed(x, y, button) function menu:mousepressed(x, y, button)
if input(button, controls.select) then if input(button, controls.select) then
Gamestate.switch(game, {boxSize = settings.difficulty.boxSize, colorStep = settings.difficulty.colorStep, timeLimit = settings.difficulty.timeLimit}, controls) Gamestate.switch(game, difficulty, controls, session)
end end
end end

View File

@@ -5,29 +5,31 @@ debug = require "conf" -- a bit redundant but makes it obvious what is global
local startDate = os.date("*t", os.time()) local startDate = os.date("*t", os.time())
local logFile = "logs/" .. startDate.year .. "." .. startDate.month .. "." .. startDate.day .. "-" .. startDate.hour .. "." .. startDate.min .. ".log" local logFile = "logs/" .. startDate.year .. "." .. startDate.month .. "." .. startDate.day .. "-" .. startDate.hour .. "." .. startDate.min .. ".log"
function log(...) function log(...)
--[[ ---[[
local strings = "" local strings = ""
if type(arg) == "table" then if type(arg) == "table" then
for _,v in pairs(arg) do for _,v in ipairs(arg) do
strings = strings .. v strings = strings .. v
end end
else else
strings = arg strings = arg
end end
if love.filesystem.exists("logs") then -- make sure logs exists
if not love.filesystem.isDirectory("logs") then if love.filesystem.exists("logs") then
love.filesystem.remove() if not love.filesystem.isDirectory("logs") then
love.filesystem.createDirectory("logs") love.filesystem.remove()
end love.filesystem.createDirectory("logs")
else end
love.filesystem.createDirectory("logs") else
end love.filesystem.createDirectory("logs")
local success, errorMsg = love.filesystem.append(logFile, strings) end
if not success then -- append new data to logFile
print("Failed to write to log file.", errorMsg) local success, errorMsg = love.filesystem.append(logFile, strings)
end if not success then
--]] print("Failed to write to log file.", errorMsg)
if debug then print(...) end end
--]]
if debug then print(...) end
end end
local inifile = require "lib.inifile" local inifile = require "lib.inifile"
@@ -36,14 +38,15 @@ local menu = require "gamestates.menu"
function love.load() function love.load()
log("Loading...") log("Loading...")
-- set custom window icon love.window.setIcon(love.image.newImageData("icon.png"))
local icon = love.image.newImageData("icon.png")
love.window.setIcon(icon)
log("Window icon set.") log("Window icon set.")
-- initialize Game Jolt -- initialize Game Jolt
local initSuccess = GameJolt.init(48728, "b8e4a0eae1509d3edef3d8451bae1842") if GameJolt.init(48728, "b8e4a0eae1509d3edef3d8451bae1842") then
if initSuccess then log("Game Jolt initialized.") end log("Game Jolt initialized.")
else
log("Err: Game Jolt NOT initialized.")
end
-- load settings and change if needed -- load settings and change if needed
local gamejoltSessionOpen = false --set true if we get a session open local gamejoltSessionOpen = false --set true if we get a session open