/zoeplat

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

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-04-10 01:20:40 UTC
  • Revision ID: josh@9ix.org-20130410012040-lv7v1sc3vj7ismja
link

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
STRICT = true
2
2
DEBUG = true
3
 
RECORD = true
4
 
PLAYBACK = false
5
3
 
6
4
require 'zoetrope'
7
5
__ = require 'underscore'
8
6
--inspect = require 'inspect'
9
7
require 'pepperprof'
 
8
require 'getopt_alt'
10
9
 
11
10
util = {
12
11
   dim = function(dir)
262
261
 
263
262
              the.recorder = Recorder:new{mousePosInterval = 9999}
264
263
              the.app.meta:add(the.recorder)
265
 
              if RECORD then
 
264
              if the.app.record then
266
265
                 the.recorder:startRecording()
267
 
              elseif PLAYBACK then
 
266
              elseif the.app.playback then
268
267
                 local storage = Storage:new{filename = 'record.lua'}
269
268
                 storage:load()
270
269
                 --print(inspect(storage.data))
286
285
}
287
286
 
288
287
the.app = App:new {
 
288
   record = true,
289
289
   onRun = function (self)
290
290
              self.view = GameView:new()
291
291
              self.console:watch('onGround', 'the.player.onGround')
307
307
                       outfile:close()
308
308
                    end
309
309
 
310
 
                    if RECORD then
 
310
                    if self.record then
311
311
                       if not love.filesystem.remove('record.lua') then
312
 
                          error('could not remove record.lua')
 
312
                          print('could not remove record.lua')
313
313
                       end
314
314
                       local storage = Storage:new{
315
315
                          data = the.recorder.record,
330
330
               end
331
331
            end
332
332
}
 
333
 
 
334
function love.load (arg)
 
335
   opts = getopt(arg, '')
 
336
   if opts['p'] then
 
337
      the.app.playback = true
 
338
      the.app.record = false
 
339
   elseif opts['r'] then
 
340
      the.app.record = true
 
341
   end
 
342
 
 
343
   the.app:run()
 
344
end
 
 
b'\\ No newline at end of file'