/zoeplat

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

« back to all changes in this revision

Viewing changes to zoetrope/core/app.lua

  • Committer: Josh C
  • Date: 2013-03-04 23:27:03 UTC
  • Revision ID: josh@9ix.org-20130304232703-nob2mg5wbo5co5is
basic tiles, map, player, movement

Show diffs side-by-side

added added

removed removed

Lines of Context:
380
380
                self._sleepTime = 0
381
381
 
382
382
                -- update everyone
383
 
                -- all update events bubble up from child to parent
384
 
                -- (we consider the meta view a little 
 
383
                -- app gets precedence, then meta view, then view
385
384
 
 
385
                if self.onStartFrame then self:onStartFrame(elapsed) end
 
386
                self.meta:startFrame(elapsed)
 
387
                
386
388
                view:startFrame(elapsed)
387
 
                self.meta:startFrame(elapsed)
388
 
                if self.onStartFrame then self:onStartFrame(elapsed) end
389
 
                
390
389
                view:update(elapsed)    
391
390
                self.meta:update(elapsed)
392
391
                if self.onUpdate then self:onUpdate(elapsed) end
397
396
        end,
398
397
        
399
398
        draw = function (self)
400
 
drawStart = love.timer.getMicroTime()
401
399
                local inset = self.inset.x ~= 0 or self.inset.y ~= 0
402
400
 
403
401
                if inset then love.graphics.translate(self.inset.x, self.inset.y) end
404
402
                self.view:draw()
405
403
                self.meta:draw()
 
404
                if self.onDraw then self:onDraw() end
406
405
                if inset then love.graphics.translate(0, 0) end
407
406
 
408
407
                -- sleep off any unneeded time to keep up at our FPS
409
408
 
410
409
                local now = love.timer.getMicroTime()
411
 
the.drawTook = now - drawStart
 
410
 
412
411
                if self._nextFrameTime < now then
413
412
                        self._nextFrameTime = now
414
413
                else