diff --git a/gamecore/input.lua b/gamecore/input.lua index 539e8f8..c0c0078 100644 --- a/gamecore/input.lua +++ b/gamecore/input.lua @@ -51,7 +51,9 @@ function InputManager:isDown(sourceid, padkey) local key = self.data[sourceid].keys[padkey] isdown = love.keyboard.isDown(key) else - print("Warning: unsupported input device") + local type = self.data[sourceid].type or "nil" + local warnstring = "unsupported input device " .. type .. " for source " .. sourceid + core.debug:warning("core/input", warnstring) end return isdown diff --git a/gamecore/lang.lua b/gamecore/lang.lua index 3691707..260c82d 100644 --- a/gamecore/lang.lua +++ b/gamecore/lang.lua @@ -95,7 +95,7 @@ function LanguageManager:getTranslationStringList(lang, library) if fileinfo ~= nil then list = require(_path) else - print("WARNING: file " .. _path .. " do not exists") + core.debug:warning("core/lang","file " .. _path .. " do not exists") end return list @@ -120,7 +120,7 @@ function LanguageManager:translate(library, string) if (translation == nil) then translation = string - print("WARNING: no translation path found for " .. string .. " in " .. library) + core.debug:warning("core/lang", "no translation path found for " .. string .. " in " .. library) end return translation diff --git a/gamecore/modules/assets/animator.lua b/gamecore/modules/assets/animator.lua index 17fa139..d788949 100644 --- a/gamecore/modules/assets/animator.lua +++ b/gamecore/modules/assets/animator.lua @@ -48,7 +48,7 @@ end function Animator:update(dt) if (self.currentAnimation == "") then - print("warning: no current animation data") + core.debug:warning("animator", "no current animation data") return 0 end diff --git a/gamecore/modules/assets/init.lua b/gamecore/modules/assets/init.lua index 1634110..8dd7fb4 100644 --- a/gamecore/modules/assets/init.lua +++ b/gamecore/modules/assets/init.lua @@ -90,7 +90,7 @@ function Assets:batchImport(datafile) elseif (asset_type == "sfx") then self:importSFX(assets) else - print("Unkown asset type : " .. asset_type) + core.debug:warning("assets/importer", "unkown asset type " .. asset_type) end end end diff --git a/gamecore/modules/scenes.lua b/gamecore/modules/scenes.lua index 9da7c83..a28f18f 100644 --- a/gamecore/modules/scenes.lua +++ b/gamecore/modules/scenes.lua @@ -150,7 +150,7 @@ end function Scene:getKeys(sourceid) if sourceid == nil then - print("WARNING", "no sourceid detected, will default to 1") + core.debug:warning("scene", "no sourceid detected, will default to 1") end local sourceid = sourceid or 1 diff --git a/gamecore/modules/world/actors/actor2D.lua b/gamecore/modules/world/actors/actor2D.lua index 0c2c5c6..1b8c794 100644 --- a/gamecore/modules/world/actors/actor2D.lua +++ b/gamecore/modules/world/actors/actor2D.lua @@ -163,7 +163,7 @@ end function Actor2D:addHitbox(name, type, ox, oy, w, h, isSolid) if (self.hitboxes[name] ~= nil) then - print("ERROR:", "The hitbox " .. name .. " already exists") + core.debug:warning("actor2D", "the hitbox " .. name .. " already exists") else local hitbox = Hitbox(self, type, ox, oy, w, h, isSolid) self.hitboxes[name] = hitbox diff --git a/gamecore/modules/world/actors/actor3D.lua b/gamecore/modules/world/actors/actor3D.lua index a87142c..c5f4208 100644 --- a/gamecore/modules/world/actors/actor3D.lua +++ b/gamecore/modules/world/actors/actor3D.lua @@ -187,7 +187,7 @@ end function Actor3D:addHitbox(name, type, ox, oy, oz, w, h, d, isSolid) if (self.hitboxes[name] ~= nil) then - print("ERROR:", "The hitbox " .. name .. " already exists") + core.debug:warning("actor3D", "the hitbox " .. name .. " already exists") else local hitbox = Hitbox(self, type, ox, oy, oz, w, h, d, isSolid) self.hitboxes[name] = hitbox diff --git a/gamecore/modules/world/actors/utils/boxes/mapped.lua b/gamecore/modules/world/actors/utils/boxes/mapped.lua index ce7cb67..e733cab 100644 --- a/gamecore/modules/world/actors/utils/boxes/mapped.lua +++ b/gamecore/modules/world/actors/utils/boxes/mapped.lua @@ -36,8 +36,8 @@ function MappedBox:new(owner, x, y, z, w, h, d) end function MappedBox:drawTextureContent() - print(self.x, self.y, self.z) local tx, ty = self.x, self.y - (self.z + self.d) + core.debug:print("mappedbox", "getting map layers at position " .. tx .. ";" .. ty) love.graphics.push() love.graphics.origin() love.graphics.translate(math.floor(-tx), math.floor(-ty)) diff --git a/gamecore/modules/world/baseworld.lua b/gamecore/modules/world/baseworld.lua index 9ac5ac7..c0c29a9 100644 --- a/gamecore/modules/world/baseworld.lua +++ b/gamecore/modules/world/baseworld.lua @@ -103,11 +103,16 @@ function BaseWorld:initActors( ) end function BaseWorld:newActor(name, x, y, z) + local debugstring = " at (" .. x .. ";" .. y .. ")." + core.debug:print("world2D", "adding actor " .. name .. debugstring) self.obj.index[name](self, x, y) end function BaseWorld:newCollision(name, x, y, z, w, h, d) - print("Creating collision " .. name .. " at position " .. x .. ";" .. y .. ". Size is " .. w .. ";" .. h) + local debugstringpos = "at (" .. x .. ";" .. y .. ")" + local debugstringsize = "size is (" .. w .. ";" .. h .. ")" + local debugstring = " " .. debugstringpos .. ". " .. debugstringsize .. "." + core.debug:print("world2D", "creating collision " .. name .. debugstring) self.obj.collisions[name](self, x, y, w, h) end diff --git a/gamecore/modules/world/camera/init.lua b/gamecore/modules/world/camera/init.lua index edf6823..e3d292f 100644 --- a/gamecore/modules/world/camera/init.lua +++ b/gamecore/modules/world/camera/init.lua @@ -47,7 +47,7 @@ end function CameraSystem:setMode(mode) self.mode = mode - print("Camera system mode set to " .. mode) + core.debug:print("camera", "mode is now set to " .. mode) return mode end diff --git a/gamecore/modules/world/maps/sti.lua b/gamecore/modules/world/maps/sti.lua index 795df2d..ca10745 100644 --- a/gamecore/modules/world/maps/sti.lua +++ b/gamecore/modules/world/maps/sti.lua @@ -33,7 +33,8 @@ end function StiMap:loadCollisions() for k, objectlayer in pairs(self.sti.layers) do if self.world:isCollisionIndexed(objectlayer.name) then - print("DEBUG: loading actors in " .. objectlayer.name .. " collision layer") + local debugstring = "loading " .. #objectlayer.objects .. " objects in " .. objectlayer.name .. " collision layer" + core.debug:print("map/sti", debugstring) for k, object in pairs(objectlayer.objects) do self:newCollision(objectlayer, object) end @@ -45,7 +46,8 @@ end function StiMap:loadActors() for k, objectlayer in pairs(self.sti.layers) do if self.world:isActorIndexed(objectlayer.name) then - print("DEBUG: loading actors in " .. objectlayer.name .. " actor layer") + local debugstring = "loading " .. #objectlayer.objects .. " objects in " .. objectlayer.name .. " actor layer" + core.debug:print("map/sti", debugstring) for k, object in pairs(objectlayer.objects) do if (object.properties.batchActor) then self:batchActor(objectlayer, object) @@ -61,7 +63,8 @@ end function StiMap:loadPlayers() for k, objectlayer in pairs(self.sti.layers) do if (objectlayer.name == "player") then - print("DEBUG: loading actors in player layer") + local debugstring = "loading at most " .. #objectlayer.objects .. " actors in " .. objectlayer.name .. " actor layer" + core.debug:print("map/sti", debugstring) local i = 1 for k, object in pairs(objectlayer.objects) do self:newPlayer(object, i) @@ -87,7 +90,6 @@ function StiMap:batchActor(objectlayer, object) for i=1, cellHor do for j=1, cellVert do - print("DEBUG:", "Setting the world to create actor " .. name) self.world:newActor(name, x + (i-1)*gwidth, y + (j-1)*gheight, z) end end @@ -102,7 +104,6 @@ function StiMap:newActor(objectlayer, object) y = y + z end - print("DEBUG:", "Setting the world to create actor " .. objectlayer.name) self.world:newActor(objectlayer.name, object.x, y, z) end @@ -113,12 +114,12 @@ function StiMap:newCollision(objectlayer, object) local y = object.y if (fromTop) then - print("create from top, set z and y:", z, y, "=>", z-d, y+z) + local poschange = z .. ";" .. y .. " => " .. z-d .. ";" .. y+z + core.debug:print("map/sti", "create from top, set z and y: " .. poschange) y = y + z z = z - d end - print("DEBUG:", "Setting the world to create collision " .. objectlayer.name) self.world:newCollision(objectlayer.name, object.x, y, z, object.width, object.height, d) end @@ -128,10 +129,10 @@ function StiMap:newPlayer(object, i) local y = object.y if (adaptPosition) then + core.debug:print("map/sti", "adapting position, set y: " .. y .. " => ", y+z) y = y + z end - print("DEBUG:", "Setting the world to create player " .. i) self.world:addPlayer(object.x, y, z, i) end diff --git a/gamecore/options.lua b/gamecore/options.lua index d1e3424..28b8efb 100644 --- a/gamecore/options.lua +++ b/gamecore/options.lua @@ -33,10 +33,10 @@ local TRANSLATION_PATH = "datas/languages/" -- Initialize and configure the game options function OptionsManager:new(controller) + self.controller = controller -- We begin by creating an empty data table before reading the data. self.data = {} self:read() - self.controller = controller end function OptionsManager:reset() @@ -152,11 +152,11 @@ function OptionsManager:read() filepath = self:getFile(true) if utils.filesystem.exists("options.data") then local loadedDatas = binser.readFile(filepath) - print("data file found, loading it") + self.controller.debug:print("core/options", "data file found, loading it") self:setData(loadedDatas[1]) else self:reset() - print("no data file found, reseting data") + self.controller.debug:print("core/options", "no data file found, reseting data") end end