game/gui: add banner generation in gui

This commit is contained in:
Kazhnuz 2019-03-06 19:52:41 +01:00
parent 0aef838079
commit c2f435f7b6
2 changed files with 18 additions and 17 deletions

View File

@ -144,4 +144,21 @@ function ProgressBar:draw(x, y, stat, innerlabel)
love.graphics.setScissor()
end
function gui.newBanner(bannername, string)
local Banner = love.graphics.newImage( "assets/sprites/gui/" .. bannername )
local BannerFont = love.graphics.newImageFont("assets/fonts/large.png", " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ", 1)
local w, h = Banner:getDimensions()
bannercanvas = love.graphics.newCanvas(w, h)
love.graphics.setCanvas( bannercanvas )
love.graphics.draw(Banner, 0, 0)
love.graphics.setFont(BannerFont)
love.graphics.printf(string, 0, 6, 480, "center")
love.graphics.setCanvas( )
return bannercanvas
end
return gui

View File

@ -21,7 +21,7 @@ function MainMenu:new()
local screenwidth, screenheight = core.screen:getDimensions()
self:createBanner()
self.banner = game.gui.newBanner("banner.png", "IMPERIUM PORCORUM")
self.leftborder = game.gui.newBorder(0, 64+24, screenwidth)
self.rightborder = game.gui.newBorder(1, 64+24, screenwidth)
self.textbox = game.gui.newTextBox("assets/sprites/gui/textbox/bluetextbox.png", 240, 42+16)
@ -49,22 +49,6 @@ function MainMenu:createBackground( filename, emblem_filename )
love.graphics.setCanvas( )
end
function MainMenu:createBanner()
local Banner = love.graphics.newImage( "assets/sprites/gui/banner.png" )
local BannerFont = love.graphics.newImageFont("assets/fonts/large.png", " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ", 1)
local w, h = Banner:getDimensions()
self.banner = love.graphics.newCanvas(w, h)
love.graphics.setCanvas( self.banner )
love.graphics.draw(Banner, 0, 0)
love.graphics.setFont(BannerFont)
love.graphics.printf("IMPERIUM PORCORUM", 0, 6, 480, "center")
love.graphics.setCanvas( )
end
function MainMenu:selectMenu(menuID)
self.menusystem:setAllMenuVisibility(false)
self.menusystem:setAllMenuActivity(false)