improvement(cbs): make skills' name fit into the list

This commit is contained in:
Kazhnuz 2019-08-31 15:04:44 +02:00
parent d39440fa29
commit 2d462dc7f7

View file

@ -11,7 +11,7 @@ local BackMenuWidget = BattleWidget:extend()
local SkillWidget = BattleWidget:extend() local SkillWidget = BattleWidget:extend()
local MENUPOS_X1, MENUPOS_X2, MENUPOS_Y = 32, 32, 110 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 local MENU_ITEM_NUMBER = 6
function MenuConstructor:new( controller ) function MenuConstructor:new( controller )
@ -189,8 +189,22 @@ end
function BattleWidget:drawCanvas() function BattleWidget:drawCanvas()
local h local h
local asset = love.graphics.newImage("assets/gui/attacklist.png") local asset = love.graphics.newImage("assets/gui/attacklist.png")
love.graphics.draw(asset, 0, (self.height - 13) / 2) 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) h = math.floor(self.height / 2) - (self.font:getHeight() / 2)
love.graphics.setColor(0, 0, 0, .8) love.graphics.setColor(0, 0, 0, .8)
self.font:print(self.label, 17, h, "left") self.font:print(self.label, 17, h, "left")
@ -256,7 +270,11 @@ end
-- A simple widget to change menu -- A simple widget to change menu
function SubMenuWidget:new(character, menu_name, label, newmenu) 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" self.newmenu = newmenu or "BaseMenu"
end end