Class: GamesAndRpgParadise::Gtk::Pong::CenteredItem

Inherits:
Object
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/games/pong/gtk/cairo_pong.rb

Direct Known Subclasses

CenteredCircle, CenteredRect

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, width, height) ⇒ CenteredItem

#

initialize

#


26
27
28
29
30
31
# File 'lib/games_and_rpg_paradise/games/pong/gtk/cairo_pong.rb', line 26

def initialize(x, y, width, height)
  @x = x
  @y = y
  @width = width
  @height = height
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



21
22
23
# File 'lib/games_and_rpg_paradise/games/pong/gtk/cairo_pong.rb', line 21

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width.



21
22
23
# File 'lib/games_and_rpg_paradise/games/pong/gtk/cairo_pong.rb', line 21

def width
  @width
end

#xObject

Returns the value of attribute x.



20
21
22
# File 'lib/games_and_rpg_paradise/games/pong/gtk/cairo_pong.rb', line 20

def x
  @x
end

#yObject

Returns the value of attribute y.



20
21
22
# File 'lib/games_and_rpg_paradise/games/pong/gtk/cairo_pong.rb', line 20

def y
  @y
end

Instance Method Details

#max_xObject

#

max_x

#


43
44
45
# File 'lib/games_and_rpg_paradise/games/pong/gtk/cairo_pong.rb', line 43

def max_x
  @x + @width / 2
end

#max_yObject



54
55
56
# File 'lib/games_and_rpg_paradise/games/pong/gtk/cairo_pong.rb', line 54

def max_y
  @y + @height / 2
end

#min_xObject

#

min_x

#


36
37
38
# File 'lib/games_and_rpg_paradise/games/pong/gtk/cairo_pong.rb', line 36

def min_x
  @x - @width / 2
end

#min_yObject

#

min_y

#


50
51
52
# File 'lib/games_and_rpg_paradise/games/pong/gtk/cairo_pong.rb', line 50

def min_y
  @y - @height / 2
end