shit
This commit is contained in:
56
src/main.lua
56
src/main.lua
@@ -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 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 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
|
||||
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
|
||||
end
|
||||
|
||||
local inifile = require "lib.inifile"
|
||||
@@ -36,14 +38,12 @@ local menu = require "gamestates.menu"
|
||||
|
||||
function love.load()
|
||||
log("Loading...")
|
||||
-- set custom window icon
|
||||
local icon = love.image.newImageData("icon.png")
|
||||
love.window.setIcon(icon)
|
||||
love.window.setIcon(love.image.newImageData("icon.png"))
|
||||
log("Window icon set.")
|
||||
|
||||
-- initialize Game Jolt
|
||||
local initSuccess = GameJolt.init(48728, "b8e4a0eae1509d3edef3d8451bae1842")
|
||||
if initSuccess then log("Game Jolt initialized.") end
|
||||
GameJolt.init(48728, "b8e4a0eae1509d3edef3d8451bae1842")
|
||||
log("Game Jolt initialized.")
|
||||
|
||||
-- load settings and change if needed
|
||||
local gamejoltSessionOpen = false --set true if we get a session open
|
||||
@@ -65,12 +65,12 @@ function love.load()
|
||||
inifile.save("settings.ini", settings)
|
||||
error("You have been banned from Game Jolt. Your login data has been deleted, re-open RGB to continue playing without Game Jolt account integration.")
|
||||
end
|
||||
gamejoltSessionOpen = GameJolt.openSession() -- tell Game Jolt the user is playing
|
||||
if sessionSuccess then
|
||||
if GameJolt.openSession() then -- tell Game Jolt the user is playing
|
||||
-- we don't ping immediately, also the menu DOES ping immediately
|
||||
gamejoltSessionOpen = true
|
||||
log("Game Jolt session opened.")
|
||||
else
|
||||
gamejoltSessionOpen = false
|
||||
-- TODO make this known to user
|
||||
log("Couldn't open a session with Game Jolt.")
|
||||
end
|
||||
|
Reference in New Issue
Block a user