From 2d462dc7f74b3f54377d8f9a0b3ebf1f2cb5cef3 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 31 Aug 2019 15:04:44 +0200 Subject: [PATCH] improvement(cbs): make skills' name fit into the list --- .../scenes/battlesystem/menu.lua | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/sonic-radiance.love/scenes/battlesystem/menu.lua b/sonic-radiance.love/scenes/battlesystem/menu.lua index b996938..29f43a9 100644 --- a/sonic-radiance.love/scenes/battlesystem/menu.lua +++ b/sonic-radiance.love/scenes/battlesystem/menu.lua @@ -11,7 +11,7 @@ local BackMenuWidget = BattleWidget:extend() local SkillWidget = BattleWidget:extend() local MENUPOS_X1, MENUPOS_X2, MENUPOS_Y = 32, 32, 110 -local MENU_WIDTH, MENU_ITEM_HEIGHT = 112, 17 +local MENU_WIDTH, MENU_ITEM_HEIGHT = 148, 17 local MENU_ITEM_NUMBER = 6 function MenuConstructor:new( controller ) @@ -189,8 +189,22 @@ end function BattleWidget:drawCanvas() local h - local asset = love.graphics.newImage("assets/gui/attacklist.png") - love.graphics.draw(asset, 0, (self.height - 13) / 2) + local asset = love.graphics.newImage("assets/gui/attacklist.png") + local sw, sh = asset:getDimensions() + local startAsset = love.graphics.newQuad(0, 0, 16, sh, sw, sh) + local midAsset = love.graphics.newQuad(16, 0, 1, sh, sw, sh) + local endAsset = love.graphics.newQuad(sw-16, 0, 16, sh, sw, sh) + + love.graphics.draw(asset, startAsset, 0, (self.height - 13) / 2) + love.graphics.draw(asset, endAsset, self.width-16, (self.height - 13) / 2) + + local iterations = self.width-32 + + for i=0,iterations do + love.graphics.draw(asset, midAsset, 16+i, (self.height - 13) / 2) + end + + h = math.floor(self.height / 2) - (self.font:getHeight() / 2) love.graphics.setColor(0, 0, 0, .8) self.font:print(self.label, 17, h, "left") @@ -256,7 +270,11 @@ end -- A simple widget to change menu function SubMenuWidget:new(character, menu_name, label, newmenu) - SubMenuWidget.super.new(self, character, menu_name, label, "") + local label2 = "" + if label ~= "back" then + label2 = ">" + end + SubMenuWidget.super.new(self, character, menu_name, label, label2) self.newmenu = newmenu or "BaseMenu" end