Compare commits
No commits in common. "fed8ab466222ec33b39c28393be11e39a979b98a" and "6bac6704f5cd0cdbfc9ae2cec3f53b510e743d37" have entirely different histories.
fed8ab4662
...
6bac6704f5
14 changed files with 41 additions and 53 deletions
12
.vscode/settings.json
vendored
12
.vscode/settings.json
vendored
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"Lua.diagnostics.globals": [
|
|
||||||
"love",
|
|
||||||
"loadstring",
|
|
||||||
"unpack",
|
|
||||||
"birb",
|
|
||||||
"utils",
|
|
||||||
"core",
|
|
||||||
"scenes",
|
|
||||||
"game"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -69,7 +69,6 @@ end
|
||||||
|
|
||||||
function InputManager:getKey(sourceid, padkey)
|
function InputManager:getKey(sourceid, padkey)
|
||||||
local padkey = padkey
|
local padkey = padkey
|
||||||
local key
|
|
||||||
for k,v in pairs(self.data[sourceid].keys) do
|
for k,v in pairs(self.data[sourceid].keys) do
|
||||||
if (k == padkey) then key = v end
|
if (k == padkey) then key = v end
|
||||||
end
|
end
|
||||||
|
|
|
@ -121,7 +121,6 @@ function OptionsManager:getTranslationDefaultData()
|
||||||
local _path = TRANSLATION_PATH .. "init.lua"
|
local _path = TRANSLATION_PATH .. "init.lua"
|
||||||
local fileinfo = love.filesystem.getInfo(_path)
|
local fileinfo = love.filesystem.getInfo(_path)
|
||||||
local datas = nil
|
local datas = nil
|
||||||
local lang = nil
|
|
||||||
|
|
||||||
if fileinfo ~= nil then
|
if fileinfo ~= nil then
|
||||||
lang = require(TRANSLATION_PATH)
|
lang = require(TRANSLATION_PATH)
|
||||||
|
@ -147,12 +146,12 @@ end
|
||||||
function OptionsManager:write()
|
function OptionsManager:write()
|
||||||
local data = self:getData()
|
local data = self:getData()
|
||||||
|
|
||||||
local filepath = self:getFile(true)
|
filepath = self:getFile(true)
|
||||||
binser.writeFile(filepath, data)
|
binser.writeFile(filepath, data)
|
||||||
end
|
end
|
||||||
|
|
||||||
function OptionsManager:read()
|
function OptionsManager:read()
|
||||||
local filepath = self:getFile(true)
|
filepath = self:getFile(true)
|
||||||
if utils.filesystem.exists("options.data") then
|
if utils.filesystem.exists("options.data") then
|
||||||
local loadedDatas = binser.readFile(filepath)
|
local loadedDatas = binser.readFile(filepath)
|
||||||
self.core.debug:logInfo("core/options", "data file found, loading it")
|
self.core.debug:logInfo("core/options", "data file found, loading it")
|
||||||
|
|
|
@ -32,7 +32,7 @@ function Background:new(filepath)
|
||||||
self.batch = love.graphics.newSpriteBatch(self.image , 1000 )
|
self.batch = love.graphics.newSpriteBatch(self.image , 1000 )
|
||||||
|
|
||||||
self.width, self.height = self.image:getDimensions()
|
self.width, self.height = self.image:getDimensions()
|
||||||
local screenwidth, screenheight = core.screen:getDimensions()
|
screenwidth, screenheight = core.screen:getDimensions()
|
||||||
|
|
||||||
local w = math.floor(screenwidth / self.width) * self.width + 1
|
local w = math.floor(screenwidth / self.width) * self.width + 1
|
||||||
local h = math.floor(screenheight / self.height) * self.height + 1
|
local h = math.floor(screenheight / self.height) * self.height + 1
|
||||||
|
|
|
@ -136,7 +136,7 @@ function GameSystem:write()
|
||||||
if (self.currentSlot > 0) then
|
if (self.currentSlot > 0) then
|
||||||
local data = self:getData()
|
local data = self:getData()
|
||||||
|
|
||||||
local savepath = self:getSavePath(self.currentSlot, true)
|
savepath = self:getSavePath(self.currentSlot, true)
|
||||||
binser.writeFile(savepath, data)
|
binser.writeFile(savepath, data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -146,7 +146,7 @@ end
|
||||||
-- Handle the keyboard/manette functions
|
-- Handle the keyboard/manette functions
|
||||||
|
|
||||||
function GridBox:keyreleased(key, code)
|
function GridBox:keyreleased(key, code)
|
||||||
local slotID = self:getWidgetSlot(self.widget.selected)
|
slotID = self:getWidgetSlot(self.widget.selected)
|
||||||
local col, line = self.cursor.x, self.cursor.y
|
local col, line = self.cursor.x, self.cursor.y
|
||||||
if key == 'left' then
|
if key == 'left' then
|
||||||
self:moveCol(-1)
|
self:moveCol(-1)
|
||||||
|
@ -172,7 +172,7 @@ end
|
||||||
function GridBox:moveCol(direction)
|
function GridBox:moveCol(direction)
|
||||||
local orig_x, orig_y = self:getSlotCenter(self.widget.selected)
|
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 distance = self.w -- on met directement à la distance max possible le système
|
||||||
local nearestWidget = 0
|
local nearastWidget = 0
|
||||||
for i,v in ipairs(self.slots) do
|
for i,v in ipairs(self.slots) do
|
||||||
local xx, yy = self:getSlotCenter(i)
|
local xx, yy = self:getSlotCenter(i)
|
||||||
-- On commence par vérifier si le slot est bien positionné par rapport au
|
-- On commence par vérifier si le slot est bien positionné par rapport au
|
||||||
|
@ -193,7 +193,7 @@ end
|
||||||
function GridBox:moveLine(direction)
|
function GridBox:moveLine(direction)
|
||||||
local orig_x, orig_y = self:getSlotCenter(self.widget.selected)
|
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 distance = self.h -- on met directement à la distance max possible le système
|
||||||
local nearestWidget = 0
|
local nearastWidget = 0
|
||||||
for i,v in ipairs(self.slots) do
|
for i,v in ipairs(self.slots) do
|
||||||
local xx, yy = self:getSlotCenter(i)
|
local xx, yy = self:getSlotCenter(i)
|
||||||
-- On commence par vérifier si le slot est bien positionné par rapport au
|
-- On commence par vérifier si le slot est bien positionné par rapport au
|
||||||
|
|
|
@ -119,7 +119,7 @@ function BaseActor:setFilter()
|
||||||
end
|
end
|
||||||
|
|
||||||
function BaseActor:getFuturePosition(dt)
|
function BaseActor:getFuturePosition(dt)
|
||||||
local dx, dy, dz
|
local dx, dy
|
||||||
dx = self.x + self.xsp * dt
|
dx = self.x + self.xsp * dt
|
||||||
dy = self.y + self.ysp * dt
|
dy = self.y + self.ysp * dt
|
||||||
dz = self.z + self.zsp * dt
|
dz = self.z + self.zsp * dt
|
||||||
|
|
|
@ -61,7 +61,7 @@ function Box3D:setSizeFromOwner()
|
||||||
self:setSize(self.owner.w, self.owner.h, self.owner.d)
|
self:setSize(self.owner.w, self.owner.h, self.owner.d)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Box3D:setSize(w, h, d)
|
function Box3D:setSize()
|
||||||
self.w = w
|
self.w = w
|
||||||
self.h = h
|
self.h = h
|
||||||
self.d = d
|
self.d = d
|
||||||
|
|
|
@ -142,14 +142,14 @@ function BaseWorld:getActorsInRect(x, y, w, h)
|
||||||
local query = {}
|
local query = {}
|
||||||
local x2, y2 = x + w, y + h
|
local x2, y2 = x + w, y + h
|
||||||
for i,v in ipairs(self.actors) do
|
for i,v in ipairs(self.actors) do
|
||||||
if (v.x >= x) and (v.x + v.w <= x2) and
|
if (v.x >= x) and (v.x + v.w >= x1) and
|
||||||
(v.y >= y) and (v.y + v.h <= y2) then
|
(v.y >= y) and (v.y + v.h >= y1) then
|
||||||
|
|
||||||
table.insert(query, v)
|
table.insert(query, v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return query
|
return v
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ function BaseWorld:registerBody(body)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BaseWorld:updateBody(body)
|
function BaseWorld:updateBody(body)
|
||||||
return 0, 0, {}, 0
|
return x, y, {}, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function BaseWorld:removeBody(body)
|
function BaseWorld:removeBody(body)
|
||||||
|
|
|
@ -179,14 +179,16 @@ function CameraSystem:attachView(id)
|
||||||
love.graphics.setCanvas(view.canvas)
|
love.graphics.setCanvas(view.canvas)
|
||||||
love.graphics.clear()
|
love.graphics.clear()
|
||||||
|
|
||||||
|
if id ~= nil then
|
||||||
-- Du à la manière dont fonctionne STI, on est obligé de récupérer les info
|
-- 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
|
-- de position de camera pour afficher la carte par rapport à ces infos
|
||||||
local tx, ty = self:getViewCoordinate(id)
|
tx, ty = self:getViewCoordinate(id)
|
||||||
local scale = self:getViewScale(id) or 1
|
scale = self:getViewScale(id) or 1
|
||||||
tx = math.floor(tx) * -1
|
tx = math.floor(tx) * -1
|
||||||
ty = math.floor(ty) * -1
|
ty = math.floor(ty) * -1
|
||||||
|
|
||||||
local w, h = core.screen:getDimensions()
|
local w, h = core.screen:getDimensions()
|
||||||
|
end
|
||||||
|
|
||||||
love.graphics.push()
|
love.graphics.push()
|
||||||
love.graphics.origin()
|
love.graphics.origin()
|
||||||
|
|
|
@ -202,17 +202,17 @@ function World3D:zSortItems(items)
|
||||||
end
|
end
|
||||||
|
|
||||||
local _, aY, aZ, _, aH, aD = self.bodies:getCube(itemA.mainHitbox)
|
local _, aY, aZ, _, aH, aD = self.bodies:getCube(itemA.mainHitbox)
|
||||||
local aDepth = itemA.depth
|
aDepth = itemA.depth
|
||||||
local aID = itemA.creationID
|
aID = itemA.creationID
|
||||||
local aType = itemA.type
|
aType = itemA.type
|
||||||
aZ = math.ceil(aZ)
|
aZ = math.ceil(aZ)
|
||||||
aY = math.ceil(aY)
|
aY = math.ceil(aY)
|
||||||
|
|
||||||
for _, itemB in ipairs(overlapping) do
|
for _, itemB in ipairs(overlapping) do
|
||||||
local _, bY, bZ, _, bH, bD = self.bodies:getCube(itemB.mainHitbox)
|
local _, bY, bZ, _, bH, bD = self.bodies:getCube(itemB.mainHitbox)
|
||||||
local bDepth = itemB.depth
|
bDepth = itemB.depth
|
||||||
local bID = itemB.creationID
|
bID = itemB.creationID
|
||||||
local bType = itemB.type
|
bType = itemB.type
|
||||||
bZ = math.ceil(bZ)
|
bZ = math.ceil(bZ)
|
||||||
bY = math.ceil(bY)
|
bY = math.ceil(bY)
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ function World3D:zSortItems(items)
|
||||||
elseif aID < bID then
|
elseif aID < bID then
|
||||||
graph:add(itemB, itemA)
|
graph:add(itemB, itemA)
|
||||||
else
|
else
|
||||||
error("two object can't have the same ID")
|
err("two object can't have the same ID")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -69,7 +69,7 @@ function Graphics.printWithSpacing(text, spacing, align, x, y, r, sx, sy, ox, oy
|
||||||
|
|
||||||
for i=1, lenght do
|
for i=1, lenght do
|
||||||
local char = string.sub(text, i, i)
|
local char = string.sub(text, i, i)
|
||||||
local pos = math.floor(x + xx - width)
|
pos = math.floor(x + xx - width)
|
||||||
love.graphics.print(char, pos, y)
|
love.graphics.print(char, pos, y)
|
||||||
xx = xx + font:getWidth(char) + spacing
|
xx = xx + font:getWidth(char) + spacing
|
||||||
end
|
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 color = love.graphics.getColor()
|
||||||
local b = border or 1
|
local b = border or 1
|
||||||
love.graphics.setColor(0, 0, 0, 0)
|
love.graphics.setColor(0, 0, 0, 0)
|
||||||
love.graphics.draw(drawable, x-b, y-b, 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, 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, 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 , 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 , 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-b, y+b, limit, align, 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 , 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+b, y+b, limit, align, r, sx, sy, ox, oy, kx, ky)
|
||||||
love.graphics.setColor(color)
|
love.graphics.setColor(color)
|
||||||
|
|
||||||
love.graphics.draw(drawable, x, y, r, sx, sy, ox, oy, kx, ky)
|
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 y = math.floor(y)
|
||||||
local w = math.floor(w)
|
local w = math.floor(w)
|
||||||
local h = math.floor(h)
|
local h = math.floor(h)
|
||||||
|
local a = a or 1
|
||||||
|
|
||||||
local r, g, b, a = love.graphics.getColor( )
|
local r, g, b, a = love.graphics.getColor( )
|
||||||
a = a or 1
|
|
||||||
|
|
||||||
love.graphics.setColor(r, g, b, 0.3 * a)
|
love.graphics.setColor(r, g, b, 0.3 * a)
|
||||||
love.graphics.rectangle("fill", x, y, w, h)
|
love.graphics.rectangle("fill", x, y, w, h)
|
||||||
|
|
|
@ -63,7 +63,7 @@ function Math.vector(x1, y1, x2, y2)
|
||||||
local vecx, vecy
|
local vecx, vecy
|
||||||
|
|
||||||
vecx = x2 - x1
|
vecx = x2 - x1
|
||||||
vecy = y2 - y1
|
vexy = y2 - y1
|
||||||
|
|
||||||
return vecx, vecy
|
return vecx, vecy
|
||||||
end
|
end
|
||||||
|
@ -107,7 +107,7 @@ function Math.numberToString(x, length)
|
||||||
local string = ""
|
local string = ""
|
||||||
local x = x
|
local x = x
|
||||||
if (x >= math.pow(10, length)) then
|
if (x >= math.pow(10, length)) then
|
||||||
x = length*10 - 1
|
x = unitsNumber*10 - 1
|
||||||
string = string .. x
|
string = string .. x
|
||||||
else
|
else
|
||||||
for i=1, (length-1) do
|
for i=1, (length-1) do
|
||||||
|
|
|
@ -113,7 +113,7 @@ function widgets.Switch:new(scene, menu, keyname)
|
||||||
local label = core.lang:translate("options", keyname)
|
local label = core.lang:translate("options", keyname)
|
||||||
local label2 = self:getLabel()
|
local label2 = self:getLabel()
|
||||||
widgets.Switch.super.new(self, widgetmenu, font, label, label2)
|
widgets.Switch.super.new(self, widgetmenu, font, label, label2)
|
||||||
self.order = 0
|
self.order = order or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function widgets.Switch:modifyKey()
|
function widgets.Switch:modifyKey()
|
||||||
|
@ -263,7 +263,7 @@ end
|
||||||
|
|
||||||
function widgets.Audio:new(scene, menu, audiotype)
|
function widgets.Audio:new(scene, menu, audiotype)
|
||||||
self.scene = scene
|
self.scene = scene
|
||||||
self.audiotype = audiotype
|
self.audiotype = key
|
||||||
|
|
||||||
|
|
||||||
local widgetmenu = self.scene.menusystem.menus[menu]
|
local widgetmenu = self.scene.menusystem.menus[menu]
|
||||||
|
|
Loading…
Reference in a new issue