Class: EhbGameLib::Window
- Inherits:
-
Chingu::Window
- Object
- Chingu::Window
- EhbGameLib::Window
- Defined in:
- lib/ehb_game_lib/window.rb,
lib/ehb_game_lib/window/gl_read_pixels_image.rb
Defined Under Namespace
Classes: GlReadPixelsImage
Instance Attribute Summary collapse
-
#canvas ⇒ Object
readonly
Returns the value of attribute canvas.
-
#canvas_factor ⇒ Object
Returns the value of attribute canvas_factor.
-
#draw_retro ⇒ Object
Returns the value of attribute draw_retro.
-
#fit_canvas_to_window ⇒ Object
Returns the value of attribute fit_canvas_to_window.
Instance Method Summary collapse
- #calculated_height ⇒ Object
- #calculated_width ⇒ Object
- #draw ⇒ Object
- #fullscreen=(value) ⇒ Object
-
#initialize(canvas_width, canvas_height) ⇒ Window
constructor
A new instance of Window.
Constructor Details
#initialize(canvas_width, canvas_height) ⇒ Window
Returns a new instance of Window.
13 14 15 16 17 18 19 20 |
# File 'lib/ehb_game_lib/window.rb', line 13 def initialize(canvas_width, canvas_height) @canvas = ::EhbGameLib::Canvas.new(canvas_width, canvas_height) @canvas_factor = 1 self.fit_canvas_to_window = true self.draw_retro = true super calculated_width, calculated_height dimensions_reset end |
Instance Attribute Details
#canvas ⇒ Object (readonly)
Returns the value of attribute canvas.
11 12 13 |
# File 'lib/ehb_game_lib/window.rb', line 11 def canvas @canvas end |
#canvas_factor ⇒ Object
Returns the value of attribute canvas_factor.
11 12 13 |
# File 'lib/ehb_game_lib/window.rb', line 11 def canvas_factor @canvas_factor end |
#draw_retro ⇒ Object
Returns the value of attribute draw_retro.
10 11 12 |
# File 'lib/ehb_game_lib/window.rb', line 10 def draw_retro @draw_retro end |
#fit_canvas_to_window ⇒ Object
Returns the value of attribute fit_canvas_to_window.
10 11 12 |
# File 'lib/ehb_game_lib/window.rb', line 10 def fit_canvas_to_window @fit_canvas_to_window end |
Instance Method Details
#calculated_height ⇒ Object
26 27 28 |
# File 'lib/ehb_game_lib/window.rb', line 26 def calculated_height canvas.height * canvas_factor end |
#calculated_width ⇒ Object
22 23 24 |
# File 'lib/ehb_game_lib/window.rb', line 22 def calculated_width canvas.width * canvas_factor end |
#draw ⇒ Object
40 41 42 43 |
# File 'lib/ehb_game_lib/window.rb', line 40 def draw super if ::EhbGameLib::Globals.window draw_resized end |
#fullscreen=(value) ⇒ Object
35 36 37 38 |
# File 'lib/ehb_game_lib/window.rb', line 35 def fullscreen=(value) super(value) dimensions_reset end |