/ld28

To get this branch, use:
bzr branch http://9ix.org/bzr/ld28

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-12-15 19:59:03 UTC
  • Revision ID: josh@9ix.org-20131215195903-3pb7rnz9xow0wkc9
move quit keybindings to app

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
 
80
80
                    the.player.moved = false
81
81
                 end
82
 
 
83
 
                 if the.keys:justPressed('escape', 'q') then
84
 
                    the.app:quit()
85
 
                 end
86
82
              end,
87
83
}
88
84
 
117
113
           end
118
114
}
119
115
 
 
116
TitleView = View:extend {
 
117
   onNew = function(self)
 
118
              self:add(Tile:new{
 
119
                          image = 'data/title.png'
 
120
                       })
 
121
           end,
 
122
   onUpdate = function(self)
 
123
                 if the.keys:allJustPressed() then
 
124
                    the.app.view = GameView:new{level = 1}
 
125
                 end
 
126
              end
 
127
}
 
128
 
120
129
the.app = App:new {
121
130
   name = "LD28",
122
131
   fps = 30,
123
132
   onRun = function (self)
124
133
              print('Version: ' .. VERSION)
125
134
 
126
 
              self.view = GameView:new{level = 1}
127
 
              --self.view = SlowView:new{level = 1}
 
135
              --self.view = GameView:new{level = 1}
 
136
              self.view = TitleView:new()
128
137
 
129
138
              if DEBUG then
130
139
                 self.console:watch('VERSION', 'VERSION')
139
148
                    local ss = love.graphics.newScreenshot()
140
149
                    ss:encode('screenshot-' ..love.timer.getTime()..'.png')
141
150
                 end
 
151
 
 
152
                 if the.keys:justPressed('escape', 'q') then
 
153
                    the.app:quit()
 
154
                 end
142
155
              end
143
156
}