/ld26

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

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-04-27 16:36:06 UTC
  • Revision ID: josh@9ix.org-20130427163606-0eef0f5v9wbzoi0j
zoetrope 1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
STRICT = true
2
 
DEBUG = true
3
 
 
4
 
require 'zoetrope'
5
 
 
6
 
--require 'sprite'
7
 
require 'version'
8
 
 
9
 
require 'player'
10
 
 
11
 
GameView = View:extend {
12
 
   onNew = function (self)
13
 
              bg = Tile:new{image = 'data/forest1-bg.png'}
14
 
              fg = Tile:new{image = 'data/forest1-fg.png'}
15
 
              the.player = Player:new{x = 196, y = 350}
16
 
              self:add(bg)
17
 
              self:add(the.player)
18
 
              self:add(fg)
19
 
 
20
 
              --self:loadLayers('data/map.lua')
21
 
              --self.focus = the.player
22
 
              --self:clampTo(self.map)
23
 
           end,
24
 
   draw = function (self, x, y)
25
 
             View.draw(self, x, y)
26
 
             love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
27
 
          end
28
 
}
29
 
 
30
 
the.app = App:new {
31
 
   onRun = function (self)
32
 
              self.view = GameView:new()
33
 
              if DEBUG then
34
 
                 self.console:watch('VERSION', 'VERSION')
35
 
                 self.console:watch('updateTook', 'the.updateTook')
36
 
                 --self.console:watch('drawTook', 'the.drawTook')
37
 
              end
38
 
           end,
39
 
   onUpdate = function (self, dt)
40
 
                 if the.keys:justPressed('escape') then
41
 
                    self.quit()
42
 
                 end
43
 
              end,
44
 
   update = function (self, dt)
45
 
               the.updateStart = love.timer.getMicroTime()
46
 
               App.update(self, dt)
47
 
               if the.updateStart then
48
 
                  the.updateTook = love.timer.getMicroTime() - the.updateStart
49
 
               end
50
 
            end
51
 
}