diff --git a/birb/core/input.lua b/birb/core/input.lua index b8d0c70..5304b1f 100644 --- a/birb/core/input.lua +++ b/birb/core/input.lua @@ -69,6 +69,7 @@ end function InputManager:getKey(sourceid, padkey) local padkey = padkey + local key for k,v in pairs(self.data[sourceid].keys) do if (k == padkey) then key = v end end diff --git a/birb/core/options.lua b/birb/core/options.lua index 46b0ce9..96b4d9c 100644 --- a/birb/core/options.lua +++ b/birb/core/options.lua @@ -121,6 +121,7 @@ function OptionsManager:getTranslationDefaultData() local _path = TRANSLATION_PATH .. "init.lua" local fileinfo = love.filesystem.getInfo(_path) local datas = nil + local lang = nil if fileinfo ~= nil then lang = require(TRANSLATION_PATH) @@ -146,12 +147,12 @@ end function OptionsManager:write() local data = self:getData() - filepath = self:getFile(true) + local filepath = self:getFile(true) binser.writeFile(filepath, data) end function OptionsManager:read() - filepath = self:getFile(true) + local filepath = self:getFile(true) if utils.filesystem.exists("options.data") then local loadedDatas = binser.readFile(filepath) self.core.debug:logInfo("core/options", "data file found, loading it") diff --git a/birb/modules/assets/background.lua b/birb/modules/assets/background.lua index 7a0ac56..4c4ecca 100644 --- a/birb/modules/assets/background.lua +++ b/birb/modules/assets/background.lua @@ -32,7 +32,7 @@ function Background:new(filepath) self.batch = love.graphics.newSpriteBatch(self.image , 1000 ) self.width, self.height = self.image:getDimensions() - screenwidth, screenheight = core.screen:getDimensions() + local screenwidth, screenheight = core.screen:getDimensions() local w = math.floor(screenwidth / self.width) * self.width + 1 local h = math.floor(screenheight / self.height) * self.height + 1 diff --git a/birb/modules/gamesystem/init.lua b/birb/modules/gamesystem/init.lua index 82b0649..5841f16 100644 --- a/birb/modules/gamesystem/init.lua +++ b/birb/modules/gamesystem/init.lua @@ -136,7 +136,7 @@ function GameSystem:write() if (self.currentSlot > 0) then local data = self:getData() - savepath = self:getSavePath(self.currentSlot, true) + local savepath = self:getSavePath(self.currentSlot, true) binser.writeFile(savepath, data) end end diff --git a/birb/modules/menusystem/grid.lua b/birb/modules/menusystem/grid.lua index e1fd8ed..3c3db9b 100644 --- a/birb/modules/menusystem/grid.lua +++ b/birb/modules/menusystem/grid.lua @@ -146,7 +146,7 @@ end -- Handle the keyboard/manette functions function GridBox:keyreleased(key, code) - slotID = self:getWidgetSlot(self.widget.selected) + local slotID = self:getWidgetSlot(self.widget.selected) local col, line = self.cursor.x, self.cursor.y if key == 'left' then self:moveCol(-1) @@ -172,7 +172,7 @@ end function GridBox:moveCol(direction) local orig_x, orig_y = self:getSlotCenter(self.widget.selected) local distance = self.w -- on met directement à la distance max possible le système - local nearastWidget = 0 + local nearestWidget = 0 for i,v in ipairs(self.slots) do local xx, yy = self:getSlotCenter(i) -- On commence par vérifier si le slot est bien positionné par rapport au @@ -193,7 +193,7 @@ end function GridBox:moveLine(direction) local orig_x, orig_y = self:getSlotCenter(self.widget.selected) local distance = self.h -- on met directement à la distance max possible le système - local nearastWidget = 0 + local nearestWidget = 0 for i,v in ipairs(self.slots) do local xx, yy = self:getSlotCenter(i) -- On commence par vérifier si le slot est bien positionné par rapport au diff --git a/birb/modules/world/actors/baseactor.lua b/birb/modules/world/actors/baseactor.lua index a119c5d..aa4e714 100644 --- a/birb/modules/world/actors/baseactor.lua +++ b/birb/modules/world/actors/baseactor.lua @@ -119,7 +119,7 @@ function BaseActor:setFilter() end function BaseActor:getFuturePosition(dt) - local dx, dy + local dx, dy, dz dx = self.x + self.xsp * dt dy = self.y + self.ysp * dt dz = self.z + self.zsp * dt diff --git a/birb/modules/world/camera/init.lua b/birb/modules/world/camera/init.lua index b5e4943..7d23816 100644 --- a/birb/modules/world/camera/init.lua +++ b/birb/modules/world/camera/init.lua @@ -179,16 +179,14 @@ function CameraSystem:attachView(id) love.graphics.setCanvas(view.canvas) love.graphics.clear() - if id ~= nil then -- Du à la manière dont fonctionne STI, on est obligé de récupérer les info -- de position de camera pour afficher la carte par rapport à ces infos - tx, ty = self:getViewCoordinate(id) - scale = self:getViewScale(id) or 1 - tx = math.floor(tx) * -1 - ty = math.floor(ty) * -1 + local tx, ty = self:getViewCoordinate(id) + local scale = self:getViewScale(id) or 1 + tx = math.floor(tx) * -1 + ty = math.floor(ty) * -1 - local w, h = core.screen:getDimensions() - end + local w, h = core.screen:getDimensions() love.graphics.push() love.graphics.origin() diff --git a/birb/modules/world/world3D.lua b/birb/modules/world/world3D.lua index 70a0696..e104123 100644 --- a/birb/modules/world/world3D.lua +++ b/birb/modules/world/world3D.lua @@ -202,17 +202,17 @@ function World3D:zSortItems(items) end local _, aY, aZ, _, aH, aD = self.bodies:getCube(itemA.mainHitbox) - aDepth = itemA.depth - aID = itemA.creationID - aType = itemA.type + local aDepth = itemA.depth + local aID = itemA.creationID + local aType = itemA.type aZ = math.ceil(aZ) aY = math.ceil(aY) for _, itemB in ipairs(overlapping) do local _, bY, bZ, _, bH, bD = self.bodies:getCube(itemB.mainHitbox) - bDepth = itemB.depth - bID = itemB.creationID - bType = itemB.type + local bDepth = itemB.depth + local bID = itemB.creationID + local bType = itemB.type bZ = math.ceil(bZ) bY = math.ceil(bY) @@ -246,7 +246,7 @@ function World3D:zSortItems(items) elseif aID < bID then graph:add(itemB, itemA) else - err("two object can't have the same ID") + error("two object can't have the same ID") end end end diff --git a/birb/utils/graphics.lua b/birb/utils/graphics.lua index 4aaac79..3587a38 100644 --- a/birb/utils/graphics.lua +++ b/birb/utils/graphics.lua @@ -69,7 +69,7 @@ function Graphics.printWithSpacing(text, spacing, align, x, y, r, sx, sy, ox, oy for i=1, lenght do local char = string.sub(text, i, i) - pos = math.floor(x + xx - width) + local pos = math.floor(x + xx - width) love.graphics.print(char, pos, y) xx = xx + font:getWidth(char) + spacing end @@ -91,16 +91,16 @@ function Graphics.drawBorder(drawable, border, x, y, r, sx, sy, ox, oy, kx, ky) local color = love.graphics.getColor() local b = border or 1 love.graphics.setColor(0, 0, 0, 0) - love.graphics.draw(drawable, x-b, y-b, limit, align, r, sx, sy, ox, oy, kx, ky) - love.graphics.draw(drawable, x , y-b, limit, align, r, sx, sy, ox, oy, kx, ky) - love.graphics.draw(drawable, x+b, y-b, limit, align, r, sx, sy, ox, oy, kx, ky) + love.graphics.draw(drawable, x-b, y-b, r, sx, sy, ox, oy, kx, ky) + love.graphics.draw(drawable, x , y-b, r, sx, sy, ox, oy, kx, ky) + love.graphics.draw(drawable, x+b, y-b, r, sx, sy, ox, oy, kx, ky) - love.graphics.draw(drawable, x+b, y , limit, align, r, sx, sy, ox, oy, kx, ky) - love.graphics.draw(drawable, x-b, y , limit, align, r, sx, sy, ox, oy, kx, ky) + love.graphics.draw(drawable, x+b, y , r, sx, sy, ox, oy, kx, ky) + love.graphics.draw(drawable, x-b, y , r, sx, sy, ox, oy, kx, ky) - love.graphics.draw(drawable, x-b, y+b, limit, align, r, sx, sy, ox, oy, kx, ky) - love.graphics.draw(drawable, x , y+b, limit, align, r, sx, sy, ox, oy, kx, ky) - love.graphics.draw(drawable, x+b, y+b, limit, align, r, sx, sy, ox, oy, kx, ky) + love.graphics.draw(drawable, x-b, y+b, r, sx, sy, ox, oy, kx, ky) + love.graphics.draw(drawable, x , y+b, r, sx, sy, ox, oy, kx, ky) + love.graphics.draw(drawable, x+b, y+b, r, sx, sy, ox, oy, kx, ky) love.graphics.setColor(color) love.graphics.draw(drawable, x, y, r, sx, sy, ox, oy, kx, ky) @@ -114,9 +114,9 @@ function Graphics.box(x, y, w, h) local y = math.floor(y) local w = math.floor(w) local h = math.floor(h) - local a = a or 1 local r, g, b, a = love.graphics.getColor( ) + a = a or 1 love.graphics.setColor(r, g, b, 0.3 * a) love.graphics.rectangle("fill", x, y, w, h) diff --git a/birb/utils/math.lua b/birb/utils/math.lua index fea382b..5f982b4 100644 --- a/birb/utils/math.lua +++ b/birb/utils/math.lua @@ -63,7 +63,7 @@ function Math.vector(x1, y1, x2, y2) local vecx, vecy vecx = x2 - x1 - vexy = y2 - y1 + vecy = y2 - y1 return vecx, vecy end @@ -107,7 +107,7 @@ function Math.numberToString(x, length) local string = "" local x = x if (x >= math.pow(10, length)) then - x = unitsNumber*10 - 1 + x = length*10 - 1 string = string .. x else for i=1, (length-1) do