Skip to content

Commit

Permalink
added graphics menu
Browse files Browse the repository at this point in the history
  • Loading branch information
daedalus committed Apr 2, 2013
1 parent b978ef9 commit eadaa8d
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 3 deletions.
Binary file modified bin/lava-temple.love
Binary file not shown.
62 changes: 62 additions & 0 deletions lib/states/graphics_menu.lua
@@ -0,0 +1,62 @@
graphics_menu = Gamestate.new()

function graphics_menu:init()
-- group defaults
gui.group.default.size[1] = 150
gui.group.default.size[2] = 25
gui.group.default.spacing = 5
end

function graphics_menu:enter(previous)

end

function graphics_menu:update(dt)
gui.group.push{grow = "down", pos = {(love.graphics.getWidth() / 2) - 130, 200}}

if gui.Button{text = "Back"} then
Gamestate.switch(pause_menu)
end

if gui.Button{text = "Fullscreen"} then
love.graphics.toggleFullscreen()
end

if gui.Button{text = "1024 x 768"} then
love.graphics.setMode(1440, 900, false, true, 0)
end

if gui.Button{text = "1440 x 900"} then
love.graphics.setMode(1440, 900, false, true, 0)
end

if gui.Button{text = "1600 x 900"} then
love.graphics.setMode(1440, 900, false, true, 0)
end

if gui.Button{text = "1680 x 1050"} then
love.graphics.setMode(1680, 1050, false, true, 0)
end

if gui.Button{text = "1600 x 1200"} then
love.graphics.setMode(1600, 1200, false, true, 0)
end

if gui.Button{text = "1920 x 1080"} then
love.graphics.setMode(1600, 1200, false, true, 0)
end

gui.group.pop{}
end

function graphics_menu:draw()
game:draw()
gui.core.draw()
end

function graphics_menu:keypressed(key, code)
gui.keyboard.pressed(key, code)
if key == "escape" then
Gamestate.switch(pause_menu)
end
end
5 changes: 2 additions & 3 deletions lib/states/pause_menu.lua
Expand Up @@ -18,9 +18,8 @@ function pause_menu:update(dt)
Gamestate.switch(game)
end

if gui.Button{text = "Fullscreen"} then
love.graphics.setMode(1680, 1050, false, true, 0)
love.graphics.toggleFullscreen()
if gui.Button{text = "Graphics"} then
Gamestate.switch(graphics_menu)
end

if gui.Button{text = "Main Menu"} then
Expand Down
1 change: 1 addition & 0 deletions main.lua
Expand Up @@ -33,6 +33,7 @@ require("lib.entities.chest")
Gamestate = require('lib.vendor.hump.gamestate')
require("lib.states.game")
require("lib.states.main_menu")
require("lib.states.graphics_menu")
require("lib.states.pause_menu")
require("lib.states.game_server")

Expand Down

0 comments on commit eadaa8d

Please sign in to comment.