Skip to content

Commit

Permalink
bigger menu
Browse files Browse the repository at this point in the history
  • Loading branch information
PriorBlue committed Mar 30, 2014
1 parent 2608a31 commit 64da4e0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 19 deletions.
1 change: 1 addition & 0 deletions game.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ function love.turris.newGame()

-- set font
font = G.newImageFont("gfx/font.png", " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&`'*#=[]\"")
font:setFilter("nearest", "nearest")
G.setFont(font)

-- create light world
Expand Down
Binary file modified gfx/tower00_diffuse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 33 additions & 19 deletions gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ gui={}
gui.current = nil
buttonDetected=0
font = love.graphics.newFont(16)
guiScale = 2.0
-- GameStates:0=MainMenu, 1=inGame, 2=Load, 3=Settings, 4=Game Over
--currentgamestate = 0

local width = love.window.getWidth()
local height = love.window.getHeight()
local buttonsizeh = 160
local buttonsizev = 64
local buttonsizeh = 158
local buttonsizev = 48

local activemenu = {
start = false,
Expand All @@ -44,9 +45,9 @@ function love.turris.checkButtonPosition(clickx,clicky)
currentgstate=love.getgamestate()
--print(love.window.getWidth())
--print(clickx.." "..clicky)
if(currentgstate==0) then--MainMenu
if((width/2)-(buttonsizeh/2)<clickx and (width/2)+(buttonsizeh/2)>clickx) then -- half horizontal screen -menu button <x or x>half horizontal screen + menu button
if(clicky>(height/5)-(buttonsizev/2) and (height/5)+(buttonsizev/2)>clicky) then
if currentgstate == 0 then--MainMenu
if (width / 2)-(buttonsizeh / 2) * guiScale < clickx and (width / 2)+(buttonsizeh / 2) * guiScale > clickx then -- half horizontal screen -menu button <x or x>half horizontal screen + menu button
if clicky > (height / 5) - (buttonsizev / 2) * guiScale and (height / 5) + (buttonsizev / 2) * guiScale > clicky then
activemenu.start = true
elseif(true) then
print("click not within y range")
Expand All @@ -55,7 +56,7 @@ function love.turris.checkButtonPosition(clickx,clicky)
else
print("click not within x range")
end
elseif (currentgstate==1) then --ingame
elseif currentgstate == 1 then --ingame
love.changegamestate(0)
--NYI
end
Expand All @@ -65,55 +66,68 @@ end
function gui.drawMainMenu()
love.graphics.setBackgroundColor(100,100,220)

local allbuttonspositionh = width/2 -- all buttons are equal in their vertical position as of yet
local startpositionv = height/5
local loadpositionv = height*2/5
local settingspositionv = height*3/5
local quitpositionv = height*4/5
local allbuttonspositionh = width/2/guiScale -- all buttons are equal in their vertical position as of yet
local startpositionv = height/5/guiScale
local loadpositionv = height*2/5/guiScale
local settingspositionv = height*3/5/guiScale
local quitpositionv = height*4/5/guiScale

G.push()
G.scale(guiScale, guiScale)

love.graphics.setColor(255, 127, 0)
--startButton

--print(allbuttonspositionh.." "..buttonsizev)
love.graphics.setColor(0, 0, 0)
G.setBlendMode("alpha")
love.graphics.setColor(0, 0, 0, 63)
love.graphics.setLineWidth(4)
love.graphics.rectangle("line", (allbuttonspositionh-(buttonsizeh/2)), (startpositionv-(buttonsizev/2)), buttonsizeh, buttonsizev)
G.setBlendMode("additive")
love.graphics.setColor(0, 127, 255)
love.graphics.setLineWidth(2)
love.graphics.rectangle("line", (allbuttonspositionh-(buttonsizeh/2)), (startpositionv-(buttonsizev/2)), buttonsizeh, buttonsizev)
--startText
love.graphics.setColor(0, 127, 255)
love.graphics.printf("Spiel starten", allbuttonspositionh-buttonsizeh/2,startpositionv-buttonsizev/2+24,buttonsizeh,"center")
love.graphics.printf("Spiel starten", allbuttonspositionh-buttonsizeh/2,startpositionv-buttonsizev/2+16,buttonsizeh,"center")
--loadbutton
love.graphics.setColor(0, 0, 0)
G.setBlendMode("alpha")
love.graphics.setColor(0, 0, 0, 63)
love.graphics.setLineWidth(4)
love.graphics.rectangle("line", (allbuttonspositionh-(buttonsizeh/2)), (loadpositionv-(buttonsizev/2)), (buttonsizeh), (buttonsizev))
G.setBlendMode("additive")
love.graphics.setColor(255, 127, 0)
love.graphics.setLineWidth(2)
love.graphics.rectangle("line", (allbuttonspositionh-(buttonsizeh/2)), (loadpositionv-(buttonsizev/2)), (buttonsizeh), (buttonsizev))
--loadText
love.graphics.setColor(255, 127, 0)
love.graphics.printf("Spiel laden", allbuttonspositionh-buttonsizeh/2,loadpositionv-(buttonsizev/2)+24,buttonsizeh,"center")
love.graphics.printf("Spiel laden", allbuttonspositionh-buttonsizeh/2,loadpositionv-(buttonsizev/2)+16,buttonsizeh,"center")
--settingsbutton
love.graphics.setColor(0, 0, 0)
G.setBlendMode("alpha")
love.graphics.setColor(0, 0, 0, 63)
love.graphics.setLineWidth(4)
love.graphics.rectangle("line", (allbuttonspositionh-(buttonsizeh/2)), (settingspositionv-(buttonsizev/2)), (buttonsizeh), (buttonsizev))
G.setBlendMode("additive")
love.graphics.setColor(255, 127, 0)
love.graphics.setLineWidth(2)
love.graphics.rectangle("line", (allbuttonspositionh-(buttonsizeh/2)), (settingspositionv-(buttonsizev/2)), (buttonsizeh), (buttonsizev))
--settingsText
love.graphics.setColor(255, 127, 0)
love.graphics.printf("Einstellungen", allbuttonspositionh-buttonsizeh/2,settingspositionv-buttonsizev/2+24,buttonsizeh,"center")
love.graphics.printf("Einstellungen", allbuttonspositionh-buttonsizeh/2,settingspositionv-buttonsizev/2+16,buttonsizeh,"center")
--quitbutton
love.graphics.setColor(0, 0, 0)
G.setBlendMode("alpha")
love.graphics.setColor(0, 0, 0, 63)
love.graphics.setLineWidth(4)
love.graphics.rectangle("line", (allbuttonspositionh-(buttonsizeh/2)), (quitpositionv-(buttonsizev/2)), (buttonsizeh), (buttonsizev))
G.setBlendMode("additive")
love.graphics.setColor(255, 127, 0)
love.graphics.setLineWidth(2)
love.graphics.rectangle("line", (allbuttonspositionh-(buttonsizeh/2)), (quitpositionv-(buttonsizev/2)), (buttonsizeh), (buttonsizev))
--quitText
love.graphics.setColor(255, 127, 0)
love.graphics.printf("Beenden", allbuttonspositionh-buttonsizeh/2,quitpositionv-buttonsizev/2+24,buttonsizeh,"center")
love.graphics.printf("Beenden", allbuttonspositionh-buttonsizeh/2,quitpositionv-buttonsizev/2+16,buttonsizeh,"center")

G.pop()
end

function love.turris.mainmenubuttonpushed()
Expand Down

0 comments on commit 64da4e0

Please sign in to comment.