From 6f19e8ddddb45eb0b1fb77e6f39fd005a2b58df2 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Fri, 28 Aug 2020 00:26:12 +0200 Subject: [PATCH] improvement: improve spacing management --- .../game/modules/menus/fancy.lua | 2 +- .../game/modules/menus/list.lua | 2 +- .../scenes/menus/options/menu.lua | 2 +- .../scenes/overworld/assets.lua | 2 ++ .../overworld/screens/mainmenu/character.lua | 24 ++++++++++--------- .../overworld/screens/mainmenu/const.lua | 6 ++--- .../overworld/screens/mainmenu/pause.lua | 7 +++--- .../scenes/overworld/screens/menu.lua | 2 +- .../scenes/overworld/screens/parent.lua | 2 +- 9 files changed, 26 insertions(+), 23 deletions(-) diff --git a/sonic-radiance.love/game/modules/menus/fancy.lua b/sonic-radiance.love/game/modules/menus/fancy.lua index 9c98d89..e48ebfa 100644 --- a/sonic-radiance.love/game/modules/menus/fancy.lua +++ b/sonic-radiance.love/game/modules/menus/fancy.lua @@ -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" diff --git a/sonic-radiance.love/game/modules/menus/list.lua b/sonic-radiance.love/game/modules/menus/list.lua index bc9a323..e59ec75 100644 --- a/sonic-radiance.love/game/modules/menus/list.lua +++ b/sonic-radiance.love/game/modules/menus/list.lua @@ -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" diff --git a/sonic-radiance.love/scenes/menus/options/menu.lua b/sonic-radiance.love/scenes/menus/options/menu.lua index 9575afe..5bd7a85 100644 --- a/sonic-radiance.love/scenes/menus/options/menu.lua +++ b/sonic-radiance.love/scenes/menus/options/menu.lua @@ -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) diff --git a/sonic-radiance.love/scenes/overworld/assets.lua b/sonic-radiance.love/scenes/overworld/assets.lua index cdb89a5..1911f0a 100644 --- a/sonic-radiance.love/scenes/overworld/assets.lua +++ b/sonic-radiance.love/scenes/overworld/assets.lua @@ -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}, diff --git a/sonic-radiance.love/scenes/overworld/screens/mainmenu/character.lua b/sonic-radiance.love/scenes/overworld/screens/mainmenu/character.lua index d26557e..ef97682 100644 --- a/sonic-radiance.love/scenes/overworld/screens/mainmenu/character.lua +++ b/sonic-radiance.love/scenes/overworld/screens/mainmenu/character.lua @@ -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 diff --git a/sonic-radiance.love/scenes/overworld/screens/mainmenu/const.lua b/sonic-radiance.love/scenes/overworld/screens/mainmenu/const.lua index 02d015a..cbfad36 100644 --- a/sonic-radiance.love/scenes/overworld/screens/mainmenu/const.lua +++ b/sonic-radiance.love/scenes/overworld/screens/mainmenu/const.lua @@ -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 diff --git a/sonic-radiance.love/scenes/overworld/screens/mainmenu/pause.lua b/sonic-radiance.love/scenes/overworld/screens/mainmenu/pause.lua index 33332b0..a0676bc 100644 --- a/sonic-radiance.love/scenes/overworld/screens/mainmenu/pause.lua +++ b/sonic-radiance.love/scenes/overworld/screens/mainmenu/pause.lua @@ -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 diff --git a/sonic-radiance.love/scenes/overworld/screens/menu.lua b/sonic-radiance.love/scenes/overworld/screens/menu.lua index a661ca8..2491ac3 100644 --- a/sonic-radiance.love/scenes/overworld/screens/menu.lua +++ b/sonic-radiance.love/scenes/overworld/screens/menu.lua @@ -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" diff --git a/sonic-radiance.love/scenes/overworld/screens/parent.lua b/sonic-radiance.love/scenes/overworld/screens/parent.lua index 83450df..fb625ef 100644 --- a/sonic-radiance.love/scenes/overworld/screens/parent.lua +++ b/sonic-radiance.love/scenes/overworld/screens/parent.lua @@ -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