Class: BeltsEngine::Tools::Window

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeWindow

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

#heightObject (readonly)

Returns the value of attribute height.



4
5
6
# File 'lib/belts_engine/tools/window.rb', line 4

def height
  @height
end

#ratioObject (readonly)

Returns the value of attribute ratio.



4
5
6
# File 'lib/belts_engine/tools/window.rb', line 4

def ratio
  @ratio
end

#titleObject (readonly)

Returns the value of attribute title.



4
5
6
# File 'lib/belts_engine/tools/window.rb', line 4

def title
  @title
end

#widthObject (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