You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
883 B
CoffeeScript
39 lines
883 B
CoffeeScript
13 years ago
|
class AsciiIo.PlayerView extends Backbone.View
|
||
13 years ago
|
|
||
13 years ago
|
initialize: (options) ->
|
||
13 years ago
|
@movie = new AsciiIo.Movie(options.data, options.timing)
|
||
13 years ago
|
@terminalView = new AsciiIo.TerminalView(
|
||
|
cols: this.options.cols
|
||
|
lines: this.options.lines
|
||
|
)
|
||
|
|
||
|
@vt = new AsciiIo.VT(options.cols, options.lines, @terminalView)
|
||
13 years ago
|
|
||
13 years ago
|
@createChildViews()
|
||
|
@bindEvents()
|
||
13 years ago
|
|
||
13 years ago
|
createChildViews: ->
|
||
|
@$el.append(@terminalView.$el)
|
||
13 years ago
|
|
||
13 years ago
|
@hudView = new AsciiIo.HudView()
|
||
|
@$el.append(@hudView.$el)
|
||
|
|
||
|
bindEvents: ->
|
||
|
@terminalView.on 'terminal-click', =>
|
||
|
@movie.togglePlay()
|
||
13 years ago
|
|
||
13 years ago
|
@hudView.on 'hud-play-click', =>
|
||
13 years ago
|
@movie.togglePlay()
|
||
13 years ago
|
|
||
|
@hudView.on 'hud-seek-click', (percent) =>
|
||
|
@movie.seek(percent)
|
||
|
|
||
|
@movie.on 'movie-frame', (frame) =>
|
||
13 years ago
|
@vt.feed(frame)
|
||
13 years ago
|
|
||
|
@movie.on 'movie-finished', =>
|
||
|
@terminalView.stopCursorBlink()
|
||
|
|
||
|
play: ->
|
||
|
@movie.play()
|