feat: style main menu
This commit is contained in:
parent
801e332b69
commit
262a46be82
8 changed files with 56 additions and 20 deletions
BIN
sonic-radiance.love/assets/artworks/back.png
Normal file
BIN
sonic-radiance.love/assets/artworks/back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 5.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 20 KiB |
BIN
sonic-radiance.love/assets/gui/back/star.png
Normal file
BIN
sonic-radiance.love/assets/gui/back/star.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
|
@ -1,5 +1,17 @@
|
||||||
local MenuBack = Object:extend()
|
local MenuBack = Object:extend()
|
||||||
|
|
||||||
|
local fancyBackShader = love.graphics.newShader[[
|
||||||
|
uniform number screenWidth;
|
||||||
|
uniform number screenHeight;
|
||||||
|
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ){
|
||||||
|
vec4 pixel = Texel(texture, texture_coords); //This is the current pixel color
|
||||||
|
number value = (screen_coords.x / screenWidth) * (screen_coords.y / screenHeight) * 0.5;
|
||||||
|
number lighten = 0.25;
|
||||||
|
return vec4(0.5 + value + lighten,0.0 + lighten,0.5 - value + lighten, 1 - pixel.r);
|
||||||
|
//return vec4(1,1,1, pixel.r);
|
||||||
|
}
|
||||||
|
]]
|
||||||
|
|
||||||
function MenuBack:new()
|
function MenuBack:new()
|
||||||
self.backx = 0
|
self.backx = 0
|
||||||
self.bordery = 0
|
self.bordery = 0
|
||||||
|
@ -7,8 +19,12 @@ function MenuBack:new()
|
||||||
self.back = love.graphics.newImage("assets/gui/back/background.png")
|
self.back = love.graphics.newImage("assets/gui/back/background.png")
|
||||||
self.border = love.graphics.newImage("assets/gui/back/border.png")
|
self.border = love.graphics.newImage("assets/gui/back/border.png")
|
||||||
self.emblem = love.graphics.newImage("assets/gui/back/emblem.png")
|
self.emblem = love.graphics.newImage("assets/gui/back/emblem.png")
|
||||||
|
self.star = love.graphics.newImage("assets/gui/back/star.png")
|
||||||
|
|
||||||
self.canvas = nil
|
self.canvas = nil
|
||||||
|
local w, h = love.graphics.getDimensions()
|
||||||
|
fancyBackShader:send("screenWidth",w)
|
||||||
|
fancyBackShader:send("screenHeight",h)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,9 +44,8 @@ function MenuBack:update(dt)
|
||||||
for j = 0, (math.ceil(240/160)), 1 do
|
for j = 0, (math.ceil(240/160)), 1 do
|
||||||
love.graphics.draw(self.border, 0, self.bordery + ((j - 1) * 160))
|
love.graphics.draw(self.border, 0, self.bordery + ((j - 1) * 160))
|
||||||
end
|
end
|
||||||
love.graphics.draw(self.emblem, 424, 240 - 32, self.turn, 0.8, 0.8, 200, 200)
|
love.graphics.draw(self.emblem, 424, 240 - 32, 0, 0.8, 0.8, 200, 200)
|
||||||
love.graphics.setColor(1, 1, 1, 0.85)
|
love.graphics.draw(self.star, 424, 240 - 32, self.turn, 0.8, 0.8, 200, 200)
|
||||||
love.graphics.rectangle("fill", 0, 0, 424, 240)
|
|
||||||
love.graphics.setColor(1, 1, 1, 1)
|
love.graphics.setColor(1, 1, 1, 1)
|
||||||
|
|
||||||
love.graphics.setCanvas()
|
love.graphics.setCanvas()
|
||||||
|
@ -39,13 +54,11 @@ end
|
||||||
|
|
||||||
|
|
||||||
function MenuBack:draw()
|
function MenuBack:draw()
|
||||||
love.graphics.setColor(1, 1, 1, 1)
|
love.graphics.setShader(fancyBackShader)
|
||||||
love.graphics.setBlendMode("multiply", "premultiplied")
|
|
||||||
if (self.canvas ~= nil) then
|
if (self.canvas ~= nil) then
|
||||||
love.graphics.draw(self.canvas, 0, 0)
|
love.graphics.draw(self.canvas, 0, 0)
|
||||||
end
|
end
|
||||||
love.graphics.setBlendMode("alpha")
|
love.graphics.setShader()
|
||||||
love.graphics.setColor(1, 1, 1, 1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return MenuBack
|
return MenuBack
|
|
@ -1,10 +1,11 @@
|
||||||
local menu = {}
|
local menu = {}
|
||||||
|
|
||||||
local RadianceListMenu = require "game.modules.menus.list"
|
local RadianceListMenu = require "game.modules.menus.fancy"
|
||||||
local Widget = require "core.modules.menusystem.widgets"
|
local Widget = require "core.modules.menusystem.widgets"
|
||||||
|
|
||||||
menu.DebugMenu = RadianceListMenu.ListMenu:extend()
|
menu.MainMenu = RadianceListMenu.FancyMenu:extend()
|
||||||
menu.SceneWidget = RadianceListMenu.DualTextWidget:extend()
|
menu.DebugMenu = RadianceListMenu.FancyMenu:extend()
|
||||||
|
menu.SceneWidget = RadianceListMenu.BaseWidget:extend()
|
||||||
|
|
||||||
local CONST = {}
|
local CONST = {}
|
||||||
CONST.MENU = {}
|
CONST.MENU = {}
|
||||||
|
@ -14,6 +15,13 @@ CONST.MENU.W = 424/2
|
||||||
CONST.MENU.ITEM_NUMBER = 8
|
CONST.MENU.ITEM_NUMBER = 8
|
||||||
|
|
||||||
-- Basic menu structure
|
-- Basic menu structure
|
||||||
|
function menu.MainMenu:new(scene, name)
|
||||||
|
local x, y = CONST.MENU.X, CONST.MENU.Y
|
||||||
|
local w = CONST.MENU.W / 1.5
|
||||||
|
local itemNumber = CONST.MENU.ITEM_NUMBER
|
||||||
|
menu.MainMenu.super.new(self, scene, name, x, y, w, itemNumber, false)
|
||||||
|
end
|
||||||
|
|
||||||
function menu.DebugMenu:new(scene, name)
|
function menu.DebugMenu:new(scene, name)
|
||||||
local x, y = CONST.MENU.X, CONST.MENU.Y
|
local x, y = CONST.MENU.X, CONST.MENU.Y
|
||||||
local w = CONST.MENU.W
|
local w = CONST.MENU.W
|
||||||
|
|
|
@ -7,11 +7,12 @@ local battleutils = require "game.utils.battle"
|
||||||
local itemutils = require "game.utils.items"
|
local itemutils = require "game.utils.items"
|
||||||
|
|
||||||
local gui = require "game.modules.gui"
|
local gui = require "game.modules.gui"
|
||||||
|
local MenuBack = require "game.modules.gui.menuback"
|
||||||
|
|
||||||
function DebugMenu:new()
|
function DebugMenu:new()
|
||||||
DebugMenu.super.new(self)
|
DebugMenu.super.new(self)
|
||||||
self.assets:batchImport("scenes.debug.commons.assets")
|
self.assets:batchImport("scenes.debug.commons.assets")
|
||||||
menu.commons.DebugMenu(self, "BaseMenu")
|
menu.commons.MainMenu(self, "BaseMenu")
|
||||||
menu.commons.SceneWidget(self, "BaseMenu", scenes.overworld, "Start playing")
|
menu.commons.SceneWidget(self, "BaseMenu", scenes.overworld, "Start playing")
|
||||||
menu.commons.SceneWidget(self, "BaseMenu", scenes.options, "Options")
|
menu.commons.SceneWidget(self, "BaseMenu", scenes.options, "Options")
|
||||||
self:buildDebugMenu()
|
self:buildDebugMenu()
|
||||||
|
@ -23,6 +24,12 @@ function DebugMenu:new()
|
||||||
self.menusystem:switchMenu("BaseMenu")
|
self.menusystem:switchMenu("BaseMenu")
|
||||||
|
|
||||||
self.panel = panels.Gamedata()
|
self.panel = panels.Gamedata()
|
||||||
|
|
||||||
|
self.borderY = 30
|
||||||
|
self.borders = gui.newBorder(424, 30, 8)
|
||||||
|
self.backImage = love.graphics.newImage("assets/artworks/back.png")
|
||||||
|
|
||||||
|
self.back = MenuBack()
|
||||||
end
|
end
|
||||||
|
|
||||||
function DebugMenu:buildDebugMenu()
|
function DebugMenu:buildDebugMenu()
|
||||||
|
@ -115,6 +122,7 @@ function DebugMenu:update(dt)
|
||||||
if (love.keyboard.isDown("space") and (not self.menusystem.isActive)) then
|
if (love.keyboard.isDown("space") and (not self.menusystem.isActive)) then
|
||||||
self.menusystem:activate()
|
self.menusystem:activate()
|
||||||
end
|
end
|
||||||
|
self.back:update(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
function DebugMenu:addSubMenu(submenu, parent, name, panel, panelArgument)
|
function DebugMenu:addSubMenu(submenu, parent, name, panel, panelArgument)
|
||||||
|
@ -126,8 +134,15 @@ function DebugMenu:addSubMenu(submenu, parent, name, panel, panelArgument)
|
||||||
end
|
end
|
||||||
|
|
||||||
function DebugMenu:draw()
|
function DebugMenu:draw()
|
||||||
|
love.graphics.setColor(1, 1, 1, 1)
|
||||||
|
love.graphics.rectangle("fill", 0, 0, 424, 240)
|
||||||
|
self.back:draw()
|
||||||
|
utils.graphics.resetColor()
|
||||||
|
love.graphics.draw(self.backImage, 0, 0)
|
||||||
if (self.menusystem.isActive) then
|
if (self.menusystem.isActive) then
|
||||||
self.assets.fonts["small"]:print("## SONIC RADIANCE - MAIN MENU ##", 424/2, 8, "center")
|
love.graphics.draw(self.borders, 0, self.borderY, 0, 1, -1)
|
||||||
|
love.graphics.draw(self.borders, 424, 240 - self.borderY, 0, -1, 1)
|
||||||
|
|
||||||
self.assets.fonts["small"]:print("v" .. game.version, 424 - 8, 240 - 20, "right")
|
self.assets.fonts["small"]:print("v" .. game.version, 424 - 8, 240 - 20, "right")
|
||||||
|
|
||||||
self.panel:draw(240, 48)
|
self.panel:draw(240, 48)
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
local commons = require "scenes.debug.commons.menu"
|
local commons = require "scenes.debug.commons.menu"
|
||||||
local listMenu = require "game.modules.menus.list"
|
local listMenu = require "game.modules.menus.fancy"
|
||||||
|
|
||||||
local menu = {}
|
local menu = {}
|
||||||
menu.commons = commons
|
menu.commons = commons
|
||||||
menu.ExitWidget = listMenu.DualTextWidget:extend()
|
menu.ExitWidget = listMenu.BaseWidget:extend()
|
||||||
menu.SaveWidget = listMenu.DualTextWidget:extend()
|
menu.SaveWidget = listMenu.BaseWidget:extend()
|
||||||
menu.LoadWidget = listMenu.DualTextWidget:extend()
|
menu.LoadWidget = listMenu.BaseWidget:extend()
|
||||||
menu.LevelUpWidget = listMenu.DualTextWidget:extend()
|
menu.LevelUpWidget = listMenu.BaseWidget:extend()
|
||||||
menu.AddRemoveWidget = listMenu.DualTextWidget:extend()
|
menu.AddRemoveWidget = listMenu.BaseWidget:extend()
|
||||||
menu.ChangeLeaderWidget = listMenu.DualTextWidget:extend()
|
menu.ChangeLeaderWidget = listMenu.BaseWidget:extend()
|
||||||
menu.ItemWidget = listMenu.DualTextWidget:extend()
|
menu.ItemWidget = listMenu.BaseWidget:extend()
|
||||||
|
|
||||||
-- ExitWidget
|
-- ExitWidget
|
||||||
function menu.ExitWidget:new(scene, menuName)
|
function menu.ExitWidget:new(scene, menuName)
|
||||||
|
|
Loading…
Reference in a new issue