improvement: add basic layout const for menus
This commit is contained in:
parent
8dbd8b45a8
commit
a9b76503b8
5 changed files with 42 additions and 16 deletions
|
@ -139,7 +139,7 @@ function MovePlayer:draw()
|
||||||
|
|
||||||
|
|
||||||
if (self.currentScreen ~= nil) then
|
if (self.currentScreen ~= nil) then
|
||||||
self.currentScreen:draw()
|
self.currentScreen:drawForeground()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ local CharacterScreen = ParentScreen:extend()
|
||||||
|
|
||||||
local menu = require "game.modules.menus.fancy"
|
local menu = require "game.modules.menus.fancy"
|
||||||
local gui = require "game.modules.gui"
|
local gui = require "game.modules.gui"
|
||||||
|
local const = require "scenes.overworld.screens.mainmenu.const"
|
||||||
|
|
||||||
local ReturnWidget = menu.BaseWidget:extend()
|
local ReturnWidget = menu.BaseWidget:extend()
|
||||||
|
|
||||||
|
@ -15,11 +16,13 @@ function CharacterScreen:new(scene, character)
|
||||||
|
|
||||||
self.artwork = love.graphics.newImage("datas/gamedata/characters/" .. character .. "/artwork.png")
|
self.artwork = love.graphics.newImage("datas/gamedata/characters/" .. character .. "/artwork.png")
|
||||||
self.artworkOrigin = require("datas.gamedata.characters." .. character .. ".artwork")
|
self.artworkOrigin = require("datas.gamedata.characters." .. character .. ".artwork")
|
||||||
CharacterScreen.super.new(self, scene)
|
CharacterScreen.super.new(self, scene, self.character.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
function CharacterScreen:setMenu()
|
function CharacterScreen:setMenu()
|
||||||
menu.FancyMenu(self.scene, "menu", 272, 140+(17*3), 128, 1, false)
|
local itemNumber = 1
|
||||||
|
local y = const.Y2 - (17*itemNumber)
|
||||||
|
menu.FancyMenu(self.scene, "menu", const.X2 - 128, y, 128, 1, false)
|
||||||
--menu.BaseWidget(self.scene, "equip", "Change talent", ">")
|
--menu.BaseWidget(self.scene, "equip", "Change talent", ">")
|
||||||
--menu.BaseWidget(self.scene, "equip", "Battle skills", ">")
|
--menu.BaseWidget(self.scene, "equip", "Battle skills", ">")
|
||||||
--menu.BaseWidget(self.scene, "equip", "Equipement", ">")
|
--menu.BaseWidget(self.scene, "equip", "Equipement", ">")
|
||||||
|
@ -31,19 +34,18 @@ function CharacterScreen:setMenu()
|
||||||
end
|
end
|
||||||
|
|
||||||
function CharacterScreen:draw()
|
function CharacterScreen:draw()
|
||||||
self.scene.assets.fonts["SA2font"]:print(self.character.name, 158, 16)
|
love.graphics.draw(self.nameBox, const.X - 4, const.Y - 4)
|
||||||
love.graphics.draw(self.nameBox, 24 - 4, 40)
|
love.graphics.draw(self.statBox, const.X - 4, 96)
|
||||||
love.graphics.draw(self.statBox, 24 - 4, 100)
|
love.graphics.draw(self.statBox, const.X - 4, 156)
|
||||||
love.graphics.draw(self.statBox, 24 - 4, 160)
|
|
||||||
local identityString = self.character.fullname .. "\n"
|
local identityString = self.character.fullname .. "\n"
|
||||||
identityString = identityString .. "Class: " .. self.character.data.class
|
identityString = identityString .. "Class: " .. self.character.data.class
|
||||||
self.scene.assets.fonts["small"]:draw(identityString, 24, 40 + 3, -1, "left")
|
self.scene.assets.fonts["small"]:draw(identityString, const.X, const.Y - 1, -1, "left")
|
||||||
|
|
||||||
local levelString = "Level: " .. self.character.level .. "\n"
|
local levelString = "Level: " .. self.character.level .. "\n"
|
||||||
local levelString = levelString .. "Current exp: " .. self.character.exp .. "\n"
|
local levelString = levelString .. "Current exp: " .. self.character.exp .. "\n"
|
||||||
local levelString = levelString .. "Next level: " .. self.character.exp_next
|
local levelString = levelString .. "Next level: " .. self.character.exp_next
|
||||||
|
|
||||||
self.scene.assets.fonts["small"]:draw(levelString, 24, 100 + 3, -1, "left")
|
self.scene.assets.fonts["small"]:draw(levelString, const.X, 96 + 3, -1, "left")
|
||||||
|
|
||||||
local statString = "ATK " .. self.character.stats.attack .. "0" .. "\n"
|
local statString = "ATK " .. self.character.stats.attack .. "0" .. "\n"
|
||||||
statString = statString .. "DEF " .. self.character.stats.defense .. "0" .. "\n"
|
statString = statString .. "DEF " .. self.character.stats.defense .. "0" .. "\n"
|
||||||
|
@ -53,8 +55,8 @@ function CharacterScreen:draw()
|
||||||
statString2 = statString2 .. "TEK " .. self.character.stats.technic .. "0"
|
statString2 = statString2 .. "TEK " .. self.character.stats.technic .. "0"
|
||||||
|
|
||||||
local separatorString = ">" .. "\n" .. ">" .. "\n" .. ">" .. "\n" .. ">" .. "\n" .. ">" .. "\n" .. ">"
|
local separatorString = ">" .. "\n" .. ">" .. "\n" .. ">" .. "\n" .. ">" .. "\n" .. ">" .. "\n" .. ">"
|
||||||
self.scene.assets.fonts["small"]:draw(statString, 24, 163, -1, "left")
|
self.scene.assets.fonts["small"]:draw(statString, const.X, 159, -1, "left")
|
||||||
self.scene.assets.fonts["small"]:draw(statString2, 24+ (176/2), 163, -1, "left")
|
self.scene.assets.fonts["small"]:draw(statString2, const.X + (176/2), 159, -1, "left")
|
||||||
--self.scene.assets.fonts["small"]:draw(separatorString, 88, 120, -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")
|
--self.scene.assets.fonts["small"]:draw("Weak to: Earth, Lightning \nResist To: Fire", 24+76, 181, -1, "left")
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
local ConstMenu = {}
|
||||||
|
|
||||||
|
ConstMenu.X = 32
|
||||||
|
ConstMenu.Y = 40
|
||||||
|
ConstMenu.WIDTH = 424 - 64
|
||||||
|
ConstMenu.HEIGHT = 240 - 80
|
||||||
|
ConstMenu.X2 = 424 - 32
|
||||||
|
ConstMenu.Y2 = 240 - 40
|
||||||
|
|
||||||
|
return ConstMenu
|
|
@ -17,15 +17,17 @@ local TeamWidget = menu.BaseWidget:extend()
|
||||||
local ViewWidget = menu.BaseWidget:extend()
|
local ViewWidget = menu.BaseWidget:extend()
|
||||||
local SaveExitWidget = menu.BaseWidget:extend()
|
local SaveExitWidget = menu.BaseWidget:extend()
|
||||||
|
|
||||||
|
local const = require "scenes.overworld.screens.mainmenu.const"
|
||||||
|
|
||||||
function PauseScreen:new(scene, menu, widget)
|
function PauseScreen:new(scene, menu, widget)
|
||||||
self.menuSelected = menu or "main"
|
self.menuSelected = menu or "main"
|
||||||
self.widgetSelected = widget
|
self.widgetSelected = widget
|
||||||
self.widget = widget
|
self.widget = widget
|
||||||
PauseScreen.super.new(self, scene)
|
PauseScreen.super.new(self, scene, "Menu")
|
||||||
end
|
end
|
||||||
|
|
||||||
function PauseScreen:setMenu()
|
function PauseScreen:setMenu()
|
||||||
menu.FancyMenu(self.scene, "main", 16, 48, 128, 8, false)
|
menu.FancyMenu(self.scene, "main", const.X - 12, const.Y, 108, 8, false)
|
||||||
TeamWidget(self.scene)
|
TeamWidget(self.scene)
|
||||||
menu.BaseWidget(self.scene, "main", "Quest", ">")
|
menu.BaseWidget(self.scene, "main", "Quest", ">")
|
||||||
menu.BaseWidget(self.scene, "main", "Items", ">")
|
menu.BaseWidget(self.scene, "main", "Items", ">")
|
||||||
|
@ -54,12 +56,14 @@ function PauseScreen:setMenu()
|
||||||
end
|
end
|
||||||
|
|
||||||
function PauseScreen:draw()
|
function PauseScreen:draw()
|
||||||
self.scene.assets.fonts["SA2font"]:print("MAIN MENU", 158, 16)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Character menu
|
-- Character menu
|
||||||
function CharacterMenu:new(scene)
|
function CharacterMenu:new(scene)
|
||||||
CharacterMenu.super.new(self, scene, "character", 168, 40, 248, 168, 4)
|
local x = const.X + 124
|
||||||
|
local w = const.WIDTH - x + 32
|
||||||
|
CharacterMenu.super.new(self, scene, "character", x, const.Y, w, const.HEIGHT, 4)
|
||||||
end
|
end
|
||||||
|
|
||||||
function CharacterMenu:cancelAction()
|
function CharacterMenu:cancelAction()
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
local MenuScreenParent = Object:extend()
|
local MenuScreenParent = Object:extend()
|
||||||
|
|
||||||
local menu = require "scenes.overworld.screens.menu"
|
local menu = require "scenes.overworld.screens.menu"
|
||||||
|
local const = require "scenes.overworld.screens.mainmenu.const"
|
||||||
|
|
||||||
function MenuScreenParent:new(scene)
|
function MenuScreenParent:new(scene, title)
|
||||||
self.scene = scene
|
self.scene = scene
|
||||||
self.menusystem = scene.menusystem
|
self.menusystem = scene.menusystem
|
||||||
|
|
||||||
self.menuObj = menu
|
self.menuObj = menu
|
||||||
|
|
||||||
|
self.title = title or ""
|
||||||
|
|
||||||
self.scene:registerScreen(self)
|
self.scene:registerScreen(self)
|
||||||
self:setMenu()
|
self:setMenu()
|
||||||
end
|
end
|
||||||
|
@ -25,6 +28,13 @@ function MenuScreenParent:quit()
|
||||||
self.scene:quitScreen()
|
self.scene:quitScreen()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function MenuScreenParent:drawForeground()
|
||||||
|
self.scene.assets.fonts["SA2font"]:print(self.title, 158, 16)
|
||||||
|
--love.graphics.rectangle("line", const.X, const.Y, const.WIDTH, const.HEIGHT)
|
||||||
|
self:draw()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function MenuScreenParent:draw()
|
function MenuScreenParent:draw()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue