/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)
189
188
                  self.jumping = false
190
189
               end
191
190
 
 
191
               -- text blob
 
192
               if not self.text then
 
193
                  self.text = Text:new{wordWrap = true, width = 50, tint = {0,0,0}}
 
194
                  self.textfill = Fill:new{width = 54, border = {0,0,255}}
 
195
                  --the.view:add(self.textfill)
 
196
                  --the.view:add(self.text)
 
197
               end
 
198
               self.text.text = "Blah blah big text etc etc wrapping"
 
199
               self.text:centerAround(self.x+16, self.y+16, 'horizontal')
 
200
               _, texth = self.text:getSize()
 
201
               self.text.y = self.y - texth - 4
 
202
               self.textfill.x = self.text.x - 2
 
203
               self.textfill.y = self.text.y - 2
 
204
               self.textfill.height = texth + 4
 
205
 
192
206
               Animation.update(self, elapsed)
193
207
            end,
194
208
   collide = function (self, ...)
247
261
 
248
262
              the.recorder = Recorder:new{mousePosInterval = 9999}
249
263
              the.app.meta:add(the.recorder)
250
 
              if RECORD then
 
264
              if the.app.record then
251
265
                 the.recorder:startRecording()
252
 
              elseif PLAYBACK then
 
266
              elseif the.app.playback then
253
267
                 local storage = Storage:new{filename = 'record.lua'}
254
268
                 storage:load()
255
269
                 --print(inspect(storage.data))
271
285
}
272
286
 
273
287
the.app = App:new {
 
288
   record = true,
274
289
   onRun = function (self)
275
290
              self.view = GameView:new()
276
291
              self.console:watch('onGround', 'the.player.onGround')
292
307
                       outfile:close()
293
308
                    end
294
309
 
295
 
                    if RECORD then
 
310
                    if self.record then
296
311
                       if not love.filesystem.remove('record.lua') then
297
 
                          error('could not remove record.lua')
 
312
                          print('could not remove record.lua')
298
313
                       end
299
314
                       local storage = Storage:new{
300
315
                          data = the.recorder.record,
315
330
               end
316
331
            end
317
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'