Class: BeltsEngine::Tools::Window
- Inherits:
-
Object
- Object
- BeltsEngine::Tools::Window
- Defined in:
- lib/belts_engine/tools/window.rb
Constant Summary collapse
- DEFAULT_WIDTH =
640- DEFAULT_HEIGHT =
480- DEFAULT_TITLE =
'Belts Demo'.freeze
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#ratio ⇒ Object
readonly
Returns the value of attribute ratio.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize ⇒ Window
constructor
A new instance of Window.
- #resize(width, height) ⇒ Object
Constructor Details
#initialize ⇒ Window
Returns a new instance of Window.
10 11 12 13 |
# File 'lib/belts_engine/tools/window.rb', line 10 def initialize @title = DEFAULT_TITLE resize(DEFAULT_WIDTH, DEFAULT_HEIGHT) end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
4 5 6 |
# File 'lib/belts_engine/tools/window.rb', line 4 def height @height end |
#ratio ⇒ Object (readonly)
Returns the value of attribute ratio.
4 5 6 |
# File 'lib/belts_engine/tools/window.rb', line 4 def ratio @ratio end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/belts_engine/tools/window.rb', line 4 def title @title end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
4 5 6 |
# File 'lib/belts_engine/tools/window.rb', line 4 def width @width end |
Instance Method Details
#resize(width, height) ⇒ Object
15 16 17 18 19 |
# File 'lib/belts_engine/tools/window.rb', line 15 def resize(width, height) @width = width @height = height @ratio = @width.to_f / @height.to_f end |