improvement: improve spacing management

This commit is contained in:
Kazhnuz 2020-08-28 00:26:12 +02:00
parent a9b76503b8
commit 6f19e8dddd
9 changed files with 26 additions and 23 deletions

View file

@ -5,7 +5,7 @@ fancy.FancyMenu = List.ListMenu:extend()
fancy.BaseWidget = List.CenteredWidget:extend()
fancy.SubMenuWidget = fancy.BaseWidget:extend()
local MENU_ITEM_HEIGHT = 17
local MENU_ITEM_HEIGHT = 16
local gui = require "game.modules.gui"

View file

@ -7,7 +7,7 @@ list.CenteredWidget = Widget.Text:extend()
list.DualTextWidget = list.CenteredWidget:extend()
list.SubMenuWidget = list.DualTextWidget:extend()
local MENU_ITEM_HEIGHT = 17
local MENU_ITEM_HEIGHT = 16
local gui = require "game.modules.gui"

View file

@ -5,7 +5,7 @@ local WIDTH = 128+32
local ITEMNUMBER = 6
function OptionMenu:new(scene, name)
local w, h = math.floor(WIDTH), math.floor(17 * ITEMNUMBER)
local w, h = math.floor(WIDTH), math.floor(16 * ITEMNUMBER)
local screenw, screenh = core.screen:getDimensions()
local x = (screenw/2) - (w/2)
local y = (screenh/2) - (h/2)

View file

@ -27,6 +27,8 @@ return {
{"lvl", "assets/gui/strings/lvl.png"},
{"exp", "assets/gui/strings/exp.png"},
{"itembox", "assets/gui/itembox.png"}
},
["fonts"] = {
{"small", "assets/gui/fonts/PixelOperator.ttf", 16},

View file

@ -21,8 +21,8 @@ end
function CharacterScreen:setMenu()
local itemNumber = 1
local y = const.Y2 - (17*itemNumber)
menu.FancyMenu(self.scene, "menu", const.X2 - 128, y, 128, 1, false)
local y = const.Y2 - (16*itemNumber) + 2
menu.FancyMenu(self.scene, "menu", const.X2 - 128 - 14, y, 128, 1, false)
--menu.BaseWidget(self.scene, "equip", "Change talent", ">")
--menu.BaseWidget(self.scene, "equip", "Battle skills", ">")
--menu.BaseWidget(self.scene, "equip", "Equipement", ">")
@ -34,29 +34,31 @@ function CharacterScreen:setMenu()
end
function CharacterScreen:draw()
love.graphics.draw(self.nameBox, const.X - 4, const.Y - 4)
love.graphics.draw(self.statBox, const.X - 4, 96)
love.graphics.draw(self.statBox, const.X - 4, 156)
love.graphics.draw(self.nameBox, const.X, const.Y)
love.graphics.draw(self.statBox, const.X, 100)
love.graphics.draw(self.nameBox, const.X, 160)
self.scene.assets.fonts["small"]:setLineHeight(16/18)
local identityString = self.character.fullname .. "\n"
identityString = identityString .. "Class: " .. self.character.data.class
self.scene.assets.fonts["small"]:draw(identityString, const.X, const.Y - 1, -1, "left")
self.scene.assets.fonts["small"]:draw(identityString, const.X + 6, const.Y +4, -1, "left")
local levelString = "Level: " .. self.character.level .. "\n"
local levelString = levelString .. "Current exp: " .. self.character.exp .. "\n"
local levelString = levelString .. "Next level: " .. self.character.exp_next
self.scene.assets.fonts["small"]:draw(levelString, const.X, 96 + 3, -1, "left")
self.scene.assets.fonts["small"]:draw(levelString, const.X + 6, 104, -1, "left")
local statString = "ATK " .. self.character.stats.attack .. "0" .. "\n"
statString = statString .. "DEF " .. self.character.stats.defense .. "0" .. "\n"
statString = statString .. "SPD " .. self.character.stats.speed .. "0" .. "\n"
statString2 = "POW " .. self.character.stats.power .. "0" .. "\n"
statString2 = statString2 .. "MND " .. self.character.stats.mind .. "0" .. "\n"
statString2 = statString2 .. "TEK " .. self.character.stats.technic .. "0"
statString3 = "SPD " .. self.character.stats.speed .. "0" .. "\n"
statString3 = statString3 .. "TEK " .. self.character.stats.technic .. "0"
local separatorString = ">" .. "\n" .. ">" .. "\n" .. ">" .. "\n" .. ">" .. "\n" .. ">" .. "\n" .. ">"
self.scene.assets.fonts["small"]:draw(statString, const.X, 159, -1, "left")
self.scene.assets.fonts["small"]:draw(statString2, const.X + (176/2), 159, -1, "left")
self.scene.assets.fonts["small"]:draw(statString, const.X + 6, 164, -1, "left")
self.scene.assets.fonts["small"]:draw(statString2, const.X + 6 + (176/3), 164, -1, "left")
self.scene.assets.fonts["small"]:draw(statString3, const.X + 6 + ((176*2)/3), 164, -1, "left")
--self.scene.assets.fonts["small"]:draw(separatorString, 88, 120, -1, "left")
--self.scene.assets.fonts["small"]:draw("Weak to: Earth, Lightning \nResist To: Fire", 24+76, 181, -1, "left")
end

View file

@ -1,10 +1,10 @@
local ConstMenu = {}
ConstMenu.X = 32
ConstMenu.X = 28
ConstMenu.Y = 40
ConstMenu.WIDTH = 424 - 64
ConstMenu.WIDTH = 424 - 56
ConstMenu.HEIGHT = 240 - 80
ConstMenu.X2 = 424 - 32
ConstMenu.X2 = 424 - 28
ConstMenu.Y2 = 240 - 40
return ConstMenu

View file

@ -27,7 +27,7 @@ function PauseScreen:new(scene, menu, widget)
end
function PauseScreen:setMenu()
menu.FancyMenu(self.scene, "main", const.X - 12, const.Y, 108, 8, false)
menu.FancyMenu(self.scene, "main", const.X, const.Y, 108, 10, false)
TeamWidget(self.scene)
menu.BaseWidget(self.scene, "main", "Quest", ">")
menu.BaseWidget(self.scene, "main", "Items", ">")
@ -61,8 +61,8 @@ end
-- Character menu
function CharacterMenu:new(scene)
local x = const.X + 124
local w = const.WIDTH - x + 32
local x = const.X + 136
local w = const.WIDTH - x + 28
CharacterMenu.super.new(self, scene, "character", x, const.Y, w, const.HEIGHT, 4)
end
@ -145,5 +145,4 @@ function SaveExitWidget:action()
end
end
return PauseScreen

View file

@ -10,7 +10,7 @@ menu.BoxedWidget = menu.BasicWidget:extend()
local CONST = {}
CONST.MENU = {}
CONST.MENU.ITEM_HEIGHT = 17
CONST.MENU.ITEM_HEIGHT = 16
local gui = require "game.modules.gui"

View file

@ -29,7 +29,7 @@ function MenuScreenParent:quit()
end
function MenuScreenParent:drawForeground()
self.scene.assets.fonts["SA2font"]:print(self.title, 158, 16)
self.scene.assets.fonts["SA2font"]:print(self.title, 160, 12)
--love.graphics.rectangle("line", const.X, const.Y, const.WIDTH, const.HEIGHT)
self:draw()
end