Class: Presentation
Constant Summary
Constants included from Soby
Instance Attribute Summary collapse
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#graphics ⇒ Object
Returns the value of attribute graphics.
-
#height ⇒ Object
Returns the value of attribute height.
-
#matrix ⇒ Object
Returns the value of attribute matrix.
-
#nb_slides ⇒ Object
readonly
Returns the value of attribute nb_slides.
-
#pshape ⇒ Object
Returns the value of attribute pshape.
-
#slides ⇒ Object
Returns the value of attribute slides.
-
#source_files ⇒ Object
readonly
Returns the value of attribute source_files.
-
#url ⇒ Object
Returns the value of attribute url.
-
#videos ⇒ Object
Returns the value of attribute videos.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
- #add_slide(new_slide) ⇒ Object
- #add_source(name) ⇒ Object
- #display_videos ⇒ Object
- #draw ⇒ Object
-
#initialize(app) ⇒ Presentation
constructor
A new instance of Presentation.
- #to_s ⇒ Object
Methods included from Soby
auto_update, #create_mat4x4, find_files, find_files_except, #get_angle, #get_global_transform, load_presentation, #read_transform, reload_presentation, start_presentation
Constructor Details
#initialize(app) ⇒ Presentation
Returns a new instance of Presentation.
18 19 20 21 22 23 24 25 |
# File 'lib/soby/presentation.rb', line 18 def initialize (app) @app = app @graphics = @app.g @slides = {} @nb_slides = 0 @playing_videos = [] @source_files = [] end |
Instance Attribute Details
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
12 13 14 |
# File 'lib/soby/presentation.rb', line 12 def debug @debug end |
#graphics ⇒ Object
Returns the value of attribute graphics.
16 17 18 |
# File 'lib/soby/presentation.rb', line 16 def graphics @graphics end |
#height ⇒ Object
Returns the value of attribute height.
11 12 13 |
# File 'lib/soby/presentation.rb', line 11 def height @height end |
#matrix ⇒ Object
Returns the value of attribute matrix.
11 12 13 |
# File 'lib/soby/presentation.rb', line 11 def matrix @matrix end |
#nb_slides ⇒ Object (readonly)
Returns the value of attribute nb_slides.
12 13 14 |
# File 'lib/soby/presentation.rb', line 12 def @nb_slides end |
#pshape ⇒ Object
Returns the value of attribute pshape.
10 11 12 |
# File 'lib/soby/presentation.rb', line 10 def pshape @pshape end |
#slides ⇒ Object
Returns the value of attribute slides.
10 11 12 |
# File 'lib/soby/presentation.rb', line 10 def @slides end |
#source_files ⇒ Object (readonly)
Returns the value of attribute source_files.
13 14 15 |
# File 'lib/soby/presentation.rb', line 13 def source_files @source_files end |
#url ⇒ Object
Returns the value of attribute url.
14 15 16 |
# File 'lib/soby/presentation.rb', line 14 def url @url end |
#videos ⇒ Object
Returns the value of attribute videos.
11 12 13 |
# File 'lib/soby/presentation.rb', line 11 def videos @videos end |
#width ⇒ Object
Returns the value of attribute width.
11 12 13 |
# File 'lib/soby/presentation.rb', line 11 def width @width end |
Instance Method Details
#add_slide(new_slide) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/soby/presentation.rb', line 36 def () puts "Add slide, id " << .title << " numero " << .sequence @slides[.sequence] = @slides[.title] = @nb_slides = @nb_slides+1 p "Adding a new slide to the presentation", @nb_slides end |
#add_source(name) ⇒ Object
27 |
# File 'lib/soby/presentation.rb', line 27 def add_source name ; @source_files << name ; end |
#display_videos ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/soby/presentation.rb', line 46 def display_videos if not @app.is_moving = @app. # # Display the videos if > 0 and @slides[].has_videos? # draw the object @graphics.imageMode(Processing::App::CORNER) @slides[].videos.each do |my_video| @graphics.push_matrix @graphics.modelview.apply(my_video.matrix) # when the video is loaded it is saved... so that the memory can # hopefully be freed @playing_videos << my_video if my_video.play ## force reading here.. my_video.video.read if my_video.video.available? # my_video.video.read @graphics.image(my_video.video, 0, 0, my_video.width, my_video.height) @graphics.pop_matrix end # videos.each else # has_videos ## no video, free some memory @playing_videos.each do |my_video| puts "Saving memory. " my_video.video.stop my_video.video = nil Java::JavaLang::System.gc end @playing_videos = [] end end end |
#draw ⇒ Object
31 32 33 34 |
# File 'lib/soby/presentation.rb', line 31 def draw @graphics.shape pshape, 0, 0 # display_videos end |
#to_s ⇒ Object
89 90 91 |
# File 'lib/soby/presentation.rb', line 89 def to_s "Slides #{@slides.size}" end |