Skip to content

Commit

Permalink
Merge pull request #54 from tesselode/master
Browse files Browse the repository at this point in the history
Fixed a typo in the gamestate docs
  • Loading branch information
vrld committed Oct 20, 2015
2 parents 5e02dcd + 7713d05 commit 7fb1142
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions docs/gamestate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ A typical game could consist of a menu-state, a level-state and a game-over-stat

local menu = {} -- previously: Gamestate.new()
local game = {}

function menu:draw()
love.graphics.print("Press Enter to continue", 10, 10)
end

function menu:keyreleased(key, code)
if key == 'enter' then
Gamestate.switch(game)
end
end

function game:enter()
Entities.clear()
-- setup entities here
end

function game:update(dt)
Entities.update(dt)
end

function game:draw()
Entities.draw()
end

function love.load()
Gamestate.registerEvents()
Gamestate.switch(menu)
Expand Down Expand Up @@ -101,6 +101,8 @@ corresponding LÖVE callbacks and receive receive the same arguments (e.g.
**Example**::

menu = {} -- previously: Gamestate.new()

function menu:init()
self.background = love.graphics.newImage('bg.jpg')
Buttons.initialize()
end
Expand Down Expand Up @@ -295,11 +297,11 @@ to be one of the :ref:`callbacks`. Mostly useful when not using
function love.draw()
Gamestate.draw() -- <callback> is `draw'
end

function love.update(dt)
Gamestate.update(dt) -- pass dt to currentState:update(dt)
end

function love.keypressed(key, code)
Gamestate.keypressed(key, code) -- pass multiple arguments
end
Expand Down Expand Up @@ -332,7 +334,7 @@ This is by done by overwriting the love callbacks, e.g.::
Gamestate.registerEvents()
Gamestate.switch(menu)
end

-- love callback will still be invoked
function love.update(dt)
Timer.update(dt)
Expand All @@ -346,4 +348,3 @@ This is by done by overwriting the love callbacks, e.g.::
Gamestate.registerEvents{'draw', 'update', 'quit'}
Gamestate.switch(menu)
end

0 comments on commit 7fb1142

Please sign in to comment.