Class: Presentation::Window

Inherits:
Gosu::Window
  • Object
show all
Defined in:
lib/presentation/window.rb

Instance Method Summary collapse

Constructor Details

#initialize(slide_deck) ⇒ Window

Returns a new instance of Window.



4
5
6
7
# File 'lib/presentation/window.rb', line 4

def initialize(slide_deck)
  @slide_deck = slide_deck
  super(1200, 600, true) # TODO: set to fullscreen when Gosu fixes issue #157
end

Instance Method Details

#button_down(button) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/presentation/window.rb', line 9

def button_down(button)
  case button
  when Gosu::KbEscape then close
  when Gosu::KbRight, Gosu::KbSpace, Gosu::KbReturn
    @slide_deck.next_slide
  when Gosu::KbLeft
    @slide_deck.previous_slide
  else
    # @slide_deck.current_slide.button_down
  end
end

#drawObject



26
27
28
# File 'lib/presentation/window.rb', line 26

def draw
  @slide_deck.current_slide.draw(self)
end

#updateObject



21
22
23
24
# File 'lib/presentation/window.rb', line 21

def update
  @slide_deck.current_slide.scroll_up if button_down? Gosu::KbDown
  @slide_deck.current_slide.scroll_down if button_down? Gosu::KbUp
end