Class: EhbGameLib::Window
- Inherits:
-
Chingu::Window
- Object
- Chingu::Window
- EhbGameLib::Window
- Defined in:
- lib/ehb_game_lib/window.rb
Defined Under Namespace
Classes: GlReadPixelsImage
Instance Attribute Summary collapse
-
#canvas_factor ⇒ Object
Returns the value of attribute canvas_factor.
-
#canvas_height ⇒ Object
readonly
Returns the value of attribute canvas_height.
-
#canvas_width ⇒ Object
readonly
Returns the value of attribute canvas_width.
-
#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
- #draw_resized ⇒ 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.
8 9 10 11 12 13 14 15 |
# File 'lib/ehb_game_lib/window.rb', line 8 def initialize(canvas_width, canvas_height) @canvas_width = canvas_width @canvas_height = canvas_height @canvas_factor = 1 self.fit_canvas_to_window = true self.draw_retro = true super calculated_width, calculated_height end |
Instance Attribute Details
#canvas_factor ⇒ Object
Returns the value of attribute canvas_factor.
6 7 8 |
# File 'lib/ehb_game_lib/window.rb', line 6 def canvas_factor @canvas_factor end |
#canvas_height ⇒ Object (readonly)
Returns the value of attribute canvas_height.
6 7 8 |
# File 'lib/ehb_game_lib/window.rb', line 6 def canvas_height @canvas_height end |
#canvas_width ⇒ Object (readonly)
Returns the value of attribute canvas_width.
6 7 8 |
# File 'lib/ehb_game_lib/window.rb', line 6 def canvas_width @canvas_width end |
#draw_retro ⇒ Object
Returns the value of attribute draw_retro.
5 6 7 |
# File 'lib/ehb_game_lib/window.rb', line 5 def draw_retro @draw_retro end |
#fit_canvas_to_window ⇒ Object
Returns the value of attribute fit_canvas_to_window.
5 6 7 |
# File 'lib/ehb_game_lib/window.rb', line 5 def fit_canvas_to_window @fit_canvas_to_window end |
Instance Method Details
#calculated_height ⇒ Object
21 22 23 |
# File 'lib/ehb_game_lib/window.rb', line 21 def calculated_height canvas_height * canvas_factor end |
#calculated_width ⇒ Object
17 18 19 |
# File 'lib/ehb_game_lib/window.rb', line 17 def calculated_width canvas_width * canvas_factor end |
#draw ⇒ Object
31 32 33 |
# File 'lib/ehb_game_lib/window.rb', line 31 def draw super if ::EhbGameLib::Globals.window end |
#draw_resized ⇒ Object
35 36 37 38 39 40 |
# File 'lib/ehb_game_lib/window.rb', line 35 def draw_resized return unless fit_canvas_to_window ::Gosu::Image.new(canvas_image_source, retro: draw_retro) .draw(0, 0, 100, canvas_factor, canvas_factor) end |