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 e470617..f0b528c 100644 Binary files a/gfx/tower00_diffuse.png and b/gfx/tower00_diffuse.png differ 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()