Skip to content

Commit

Permalink
Clean up and add game_state.started
Browse files Browse the repository at this point in the history
  • Loading branch information
TomK32 committed Dec 5, 2012
1 parent c65a976 commit dccec6a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
23 changes: 3 additions & 20 deletions game_controller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ GameController:include({
control_map = {
keyboard = {
on_press = {
k = 'inspect',
escape = 'escape',
j = 'jobs',
q = 'quit'
}
}
},
Expand All @@ -41,29 +38,15 @@ GameController:include({
end
end,

inspect = function(self)
if self.game_state.focus == 'main' then
self:setFocus('inspector')
end
self.active_controller = self.inspector_controller
end,

escape = function(self)
self:setFocus('main')
end,

toggleGameStatePaused = function(self)
self.game_state.paused = self.game_state.paused == false
end,

quit = function(self)
love.event.push('quit')
end,

jobs = function(self)
if self.game_state.focus == 'main' then
self:setFocus('jobs')
if not self.game_state.started then
self.game_state.started = true
end
self.game_state.paused = self.game_state.paused == false
end,

setFocus = function(self, focus)
Expand Down
1 change: 1 addition & 0 deletions game_state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ GameState:include({
map = nil,
player = nil,
focus = 'inspector', -- main, inspector, jobs
started = false,
paused = false,
runner = nil,
runners = {},
Expand Down
5 changes: 5 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ function love.keypressed(key, unicode)
end

function love.draw()
if not game_state.started then
start_menu_view:draw()
drawCopyright()
return
end
if game_state.paused then
-- TODO draw a background
gui_main.instructions_view:draw()
Expand Down

0 comments on commit dccec6a

Please sign in to comment.