/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:28 UTC
  • Revision ID: josh@9ix.org-20130427163628-njxr0kch1ail2y4s
build system

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
 
             love.graphics.print('version:' .. VERSION, 20, 570)
28
 
          end
29
 
}
30
 
 
31
 
the.app = App:new {
32
 
   onRun = function (self)
33
 
              self.view = GameView:new()
34
 
              if DEBUG then
35
 
                 self.console:watch('VERSION', 'VERSION')
36
 
                 self.console:watch('updateTook', 'the.updateTook')
37
 
                 --self.console:watch('drawTook', 'the.drawTook')
38
 
              end
39
 
           end,
40
 
   onUpdate = function (self, dt)
41
 
                 if the.keys:justPressed('escape') then
42
 
                    self.quit()
43
 
                 end
44
 
              end,
45
 
   update = function (self, dt)
46
 
               the.updateStart = love.timer.getMicroTime()
47
 
               App.update(self, dt)
48
 
               if the.updateStart then
49
 
                  the.updateTook = love.timer.getMicroTime() - the.updateStart
50
 
               end
51
 
            end
52
 
}