feat: add an information panel

This commit is contained in:
Kazhnuz 2020-08-02 08:30:19 +02:00
parent df2716b3df
commit e9c7026dcb
4 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,16 @@
local Parent = require "scenes.debug.menu.infopanel.parent"
local GamePanel = Parent:extend()
function GamePanel:new()
GamePanel.super.new(self)
end
function GamePanel:drawContent(x, y)
local debugString = "# Save system data" .. "\n"
debugString = debugString .. "Current slot: " .. game.slot .. " / 3" .. "\n"
debugString = debugString .. "Gametime: " .. game:getTimeString() .. "\n"
love.graphics.print(debugString, x, y)
end
return GamePanel

View file

@ -0,0 +1,5 @@
local folder = "scenes.debug.menu.infopanel."
return {
Gamedata = require(folder .. "gamedata"),
}

View file

@ -0,0 +1,17 @@
local ParentPanel = Object:extend()
local gui = require "game.modules.gui"
function ParentPanel:new()
self.panelBackground = gui.newTextBox("assets/gui/dialogbox.png", 128+32, 128)
end
function ParentPanel:draw(x, y, w, h)
love.graphics.draw(self.panelBackground, x, y)
self:drawContent(x+8, y+8)
end
function ParentPanel:drawContent(x, y)
end
return ParentPanel

View file

@ -2,6 +2,7 @@ local Scene = require "core.modules.scenes"
local menu = require "scenes.debug.menu.menu"
local DebugMenu = Scene:extend()
local panels = require "scenes.debug.menu.infopanel"
function DebugMenu:new()
DebugMenu.super.new(self)
@ -17,6 +18,8 @@ function DebugMenu:new()
self.menusystem:activate()
self.menusystem:switchMenu("BaseMenu")
self.panel = panels.Gamedata()
end
function DebugMenu:buildOverworldMenu()
@ -35,7 +38,18 @@ end
function DebugMenu:buildSaveMenu()
self:addSubMenu("save", "BaseMenu", "Save System")
self:addSubMenu("characters", "save", "Characters")
for name, data in pairs(game.characters.list) do
self:addCharacterMenu(name, data)
end
menu.commons.SubMenuWidget(self, "save", "BaseMenu", "Back")
menu.commons.SubMenuWidget(self, "characters", "save", "Back")
end
function DebugMenu:addCharacterMenu(name, data)
self:addSubMenu(name, "characters", data.fullname)
menu.commons.SubMenuWidget(self, name, "characters", "Back")
end
function DebugMenu:buildOtherMenu()
@ -63,6 +77,8 @@ function DebugMenu:draw()
if (self.menusystem.isActive) then
self.assets.fonts["small"]:print("## SONIC RADIANCE - DEBUG MENU ##", 424/2, 8, "center")
self.assets.fonts["small"]:print("v" .. game.version, 424 - 8, 240 - 22, "right")
self.panel:draw(240, 48)
end
end