Class: Gtk::Pong::CenteredItem
- Inherits:
-
Object
- Object
- Gtk::Pong::CenteredItem
show all
- Defined in:
- lib/games_paradise/pong/gtk/cairo_pong.rb
Constant Summary
collapse
- NAMESPACE =
inspect
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(x, y, width, height) ⇒ CenteredItem
24
25
26
27
28
29
|
# File 'lib/games_paradise/pong/gtk/cairo_pong.rb', line 24
def initialize(x, y, width, height)
@x = x
@y = y
@width = width
@height = height
end
|
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
19
20
21
|
# File 'lib/games_paradise/pong/gtk/cairo_pong.rb', line 19
def height
@height
end
|
#width ⇒ Object
Returns the value of attribute width.
19
20
21
|
# File 'lib/games_paradise/pong/gtk/cairo_pong.rb', line 19
def width
@width
end
|
#x ⇒ Object
Returns the value of attribute x.
18
19
20
|
# File 'lib/games_paradise/pong/gtk/cairo_pong.rb', line 18
def x
@x
end
|
#y ⇒ Object
Returns the value of attribute y.
18
19
20
|
# File 'lib/games_paradise/pong/gtk/cairo_pong.rb', line 18
def y
@y
end
|
Instance Method Details
#max_x ⇒ Object
35
36
37
|
# File 'lib/games_paradise/pong/gtk/cairo_pong.rb', line 35
def max_x
@x + @width / 2
end
|
#max_y ⇒ Object
43
44
45
|
# File 'lib/games_paradise/pong/gtk/cairo_pong.rb', line 43
def max_y
@y + @height / 2
end
|
#min_x ⇒ Object
31
32
33
|
# File 'lib/games_paradise/pong/gtk/cairo_pong.rb', line 31
def min_x
@x - @width / 2
end
|
#min_y ⇒ Object
39
40
41
|
# File 'lib/games_paradise/pong/gtk/cairo_pong.rb', line 39
def min_y
@y - @height / 2
end
|