feat: get debugLevel from commandline
This commit is contained in:
parent
d82621bf58
commit
7f22fb6ad1
3 changed files with 19 additions and 5 deletions
|
@ -32,10 +32,10 @@ local Levels = enum {
|
|||
"DEBUG"
|
||||
}
|
||||
|
||||
function DebugSystem:new(controller)
|
||||
function DebugSystem:new(controller, debugLevel)
|
||||
self.controller = controller
|
||||
|
||||
self.debugLevel = self.controller.conf.debugLevel or Levels.INFO
|
||||
self.debugLevel = debugLevel or Levels.WARNING
|
||||
self.active = (self.debugLevel == Levels.DEBUG)
|
||||
if (self.active) then
|
||||
lovebird = require "birb.libs.lovebird"
|
||||
|
|
|
@ -40,10 +40,11 @@ local DataManager = require(cwd .. "datas")
|
|||
-- INIT FUNCTIONS
|
||||
-- Initialize and configure the core object
|
||||
|
||||
function CoreSystem:new()
|
||||
function CoreSystem:new(args)
|
||||
self.args = args
|
||||
self:setDefaultConf()
|
||||
|
||||
self.debug = DebugSystem(self)
|
||||
self.debug = DebugSystem(self, self:getArg("DEBUGLEVEL", true))
|
||||
self.options = Options(self)
|
||||
self.input = Input(self)
|
||||
self.screen = Screen(self)
|
||||
|
@ -77,6 +78,20 @@ function CoreSystem:getIdentity(versionned)
|
|||
return identity
|
||||
end
|
||||
|
||||
function CoreSystem:getArg(name, isNumber)
|
||||
for _, arg in ipairs(self.args) do
|
||||
print(arg)
|
||||
local argData = utils.string.split(arg, "=")
|
||||
if (argData[1] == name) then
|
||||
if (isNumber == true) then
|
||||
return tonumber(argData[2])
|
||||
else
|
||||
return argData[2]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- MOUSE FUNCTIONS
|
||||
-- get directly the mouse when needed
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ function love.conf(t)
|
|||
t.console = false -- Attach a console (boolean, Windows only)
|
||||
t.accelerometerjoystick = false -- Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean)
|
||||
t.gammacorrect = false -- Enable gamma-correct rendering, when supported by the system (boolean)
|
||||
t.debugLevel = 4 -- Debug level mode : 0=Error only, 3=Everything.
|
||||
t.gameversion = "0.0.7" -- The game version (different than love2D version)
|
||||
|
||||
t.window.title = "Sonic Radiance" -- The window title (string)
|
||||
|
|
Loading…
Reference in a new issue