/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-04-10 23:47:59 UTC
  • Revision ID: josh@9ix.org-20130410234759-nrzne3xed1puy1v2
put sprite and player in their own files

Show diffs side-by-side

added added

removed removed

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