/zoeplat

To get this branch, use:
bzr branch /bzr/zoeplat

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-03-16 15:56:20 UTC
  • Revision ID: josh@9ix.org-20130316155620-q8dze43bqqilhtmu
profiling and analysis

Show diffs side-by-side

added added

removed removed

4
4
require 'zoetrope'
5
5
__ = require 'underscore'
6
6
--inspect = require 'inspect'
 
7
require 'pepperprof'
7
8
 
8
9
Player = Animation:extend {
9
10
   image = 'data/player.png',
232
233
              self.view = GameView:new()
233
234
              self.console:watch('onGround', 'the.player.onGround')
234
235
              self.console:watch('onWall', 'the.player.onWall')
 
236
              self.console:watch('updateTook', 'the.updateTook')
 
237
              self.console:watch('drawTook', 'the.drawTook')
 
238
 
 
239
              --the.profiler = newProfiler('time', 2000)
 
240
              --the.profiler = newProfiler()
 
241
              --the.profiler:start()
235
242
           end,
236
243
   onUpdate = function (self, dt)
237
 
                 if the.keys:justPressed('escape') and 
238
 
                   not self.console.visible then
 
244
                 if the.keys:justPressed('escape') then
 
245
                    if the.profiler then
 
246
                       the.profiler:stop()
 
247
                       local outfile = io.open( "profile.txt", "w+" )
 
248
                       the.profiler:report( outfile )
 
249
                       outfile:close()
 
250
                    end
 
251
 
239
252
                    self.quit()
240
253
                 end
241
 
              end
242
 
}
 
 
'\\ No newline at end of file'
 
254
              end,
 
255
   update = function (self, dt)
 
256
               the.updateStart = love.timer.getMicroTime()
 
257
               App.update(self, dt)
 
258
               if the.updateStart then
 
259
                  the.updateTook = love.timer.getMicroTime() - the.updateStart
 
260
               end
 
261
            end
 
262
}