Class: MultimediaParadise::GUI::VideoPlayer

Inherits:
Gosu::Window
  • Object
show all
Defined in:
lib/multimedia_paradise/gui/gosu/video_player/video_player.rb

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect
WIDTH =
#

WIDTH

#
1200
HEIGHT =
#

HEIGHT

#
480
TITLE =
#

TITLE

#
'Video Play for Gosu'

Instance Method Summary collapse

Constructor Details

#initialize(run_already = true) ⇒ VideoPlayer

#

initialize

#


38
39
40
41
42
43
44
45
# File 'lib/multimedia_paradise/gui/gosu/video_player/video_player.rb', line 38

def initialize(
    run_already = true
  )
  super(WIDTH, HEIGHT)
  set_title(TITLE)
  reset
  run if run_already
end

Instance Method Details

#button_down(id) ⇒ Object

#

button_down

#


71
72
73
74
75
76
77
# File 'lib/multimedia_paradise/gui/gosu/video_player/video_player.rb', line 71

def button_down(id)
  case id
  when Gosu::KbEscape,
       Gosu::KbQ
    close # Exit on 'Q'.
  end
end

#drawObject

#

draw

#


82
83
84
85
86
87
88
89
# File 'lib/multimedia_paradise/gui/gosu/video_player/video_player.rb', line 82

def draw
  y_position = 10 
  @font.red('A simple videoplayer in Gosu', 15, y_position)
  @available_songs.each {|this_song|
    y_position += 24
    @font.green(this_song, 15, y_position)
  }
end

#resetObject

#

reset (reset tag)

#


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/multimedia_paradise/gui/gosu/video_player/video_player.rb', line 50

def reset
  # ======================================================================= #
  # === @song
  # ======================================================================= #
  @song = Gosu::Song.new(
    '/home/x/songs/Youtube2008_Soundmix.mp3'
  )
  @song.play
  # ======================================================================= #
  # === @font
  # ======================================================================= #
  @font = set_font(:hack_30)
  # ======================================================================= #
  # === @available_songs
  # ======================================================================= #
  @available_songs = Dir['/home/x/songs/**']
end

#runObject

#

run

#


102
103
# File 'lib/multimedia_paradise/gui/gosu/video_player/video_player.rb', line 102

def run
end

#updateObject

#

update

We can not call draw methods from within the main update method.

#


96
97
# File 'lib/multimedia_paradise/gui/gosu/video_player/video_player.rb', line 96

def update
end