From 64da4e0b0ae850ca801fbfab58d75243856427ed Mon Sep 17 00:00:00 2001 From: Marcus Ihde Date: Sun, 30 Mar 2014 09:46:19 +0200 Subject: [PATCH] bigger menu --- game.lua | 1 + gfx/tower00_diffuse.png | Bin 6581 -> 6581 bytes gui.lua | 52 +++++++++++++++++++++++++--------------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/game.lua b/game.lua index 4e38639..d5cf409 100644 --- a/game.lua +++ b/game.lua @@ -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 diff --git a/gfx/tower00_diffuse.png b/gfx/tower00_diffuse.png index e470617caa50789f2628c95006ee4c6b3c6d6064..f0b528cc9b2b40dd13bebdc987dc060df6536a10 100644 GIT binary patch delta 21 dcmdmLyw!Mu4c7q%2EGG~S=Tx_H@f9Z0svK#2ZsOv delta 21 dcmdmLyw!Mu4c9>i2EK!gJ0@no-RPDt2>@C52v`6B diff --git a/gui.lua b/gui.lua index af30581..27f6b66 100644 --- a/gui.lua +++ b/gui.lua @@ -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, @@ -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) then -- half horizontal screen -menu button 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 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") @@ -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 @@ -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()