|
|
@ -4,15 +4,11 @@ class AsciiIo.PlayerView extends Backbone.View
|
|
|
|
|
|
|
|
|
|
|
|
initialize: (options) ->
|
|
|
|
initialize: (options) ->
|
|
|
|
@createMainWorker()
|
|
|
|
@createMainWorker()
|
|
|
|
@prepareSelfView()
|
|
|
|
|
|
|
|
@createRendererView()
|
|
|
|
@createRendererView()
|
|
|
|
@showLoadingIndicator()
|
|
|
|
@showLoadingIndicator()
|
|
|
|
@createHudView() if options.hud
|
|
|
|
@createHudView() if options.hud
|
|
|
|
@fetchModel()
|
|
|
|
@fetchModel()
|
|
|
|
|
|
|
|
|
|
|
|
prepareSelfView: ->
|
|
|
|
|
|
|
|
@$el.addClass('not-started')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
createRendererView: ->
|
|
|
|
createRendererView: ->
|
|
|
|
@rendererView = new @options.rendererClass(
|
|
|
|
@rendererView = new @options.rendererClass(
|
|
|
|
cols: @options.cols
|
|
|
|
cols: @options.cols
|
|
|
@ -69,12 +65,22 @@ class AsciiIo.PlayerView extends Backbone.View
|
|
|
|
@movie = new AsciiIo.MovieWorkerProxy @worker, 'movie'
|
|
|
|
@movie = new AsciiIo.MovieWorkerProxy @worker, 'movie'
|
|
|
|
|
|
|
|
|
|
|
|
bindEvents: ->
|
|
|
|
bindEvents: ->
|
|
|
|
|
|
|
|
@movie.on 'started', => @$el.addClass 'playing'
|
|
|
|
|
|
|
|
@movie.on 'finished', => @$el.removeClass 'playing'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@movie.on 'paused', =>
|
|
|
|
|
|
|
|
@$el.addClass 'paused'
|
|
|
|
|
|
|
|
@$el.removeClass 'playing'
|
|
|
|
|
|
|
|
@hudView.onPause() if @options.hud
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@movie.on 'resumed', =>
|
|
|
|
|
|
|
|
@$el.addClass 'playing'
|
|
|
|
|
|
|
|
@$el.removeClass 'paused'
|
|
|
|
|
|
|
|
@hudView.onResume() if @options.hud
|
|
|
|
|
|
|
|
|
|
|
|
if @options.hud
|
|
|
|
if @options.hud
|
|
|
|
@movie.on 'paused', => @hudView.onPause()
|
|
|
|
|
|
|
|
@movie.on 'resumed', => @hudView.onResume()
|
|
|
|
|
|
|
|
@movie.on 'time', (time) => @hudView.updateTime(time)
|
|
|
|
@movie.on 'time', (time) => @hudView.updateTime(time)
|
|
|
|
|
|
|
|
|
|
|
|
@movie.on 'started', => @$el.removeClass('not-started')
|
|
|
|
|
|
|
|
@movie.on 'render', (state) => @rendererView.render state
|
|
|
|
@movie.on 'render', (state) => @rendererView.render state
|
|
|
|
|
|
|
|
|
|
|
|
@vt.on 'cursor:blink:restart', => @rendererView.restartCursorBlink()
|
|
|
|
@vt.on 'cursor:blink:restart', => @rendererView.restartCursorBlink()
|
|
|
|