Class: GamesAndRpgParadise::GUI::Gtk::Paddle
- Inherits:
-
Object
- Object
- GamesAndRpgParadise::GUI::Gtk::Paddle
- Defined in:
- lib/games_and_rpg_paradise/gui/gtk3/block/paddle.rb
Constant Summary collapse
- WIDTH =
#
WIDTH
#
95
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#width ⇒ Object
Returns the value of attribute width.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
-
#draw ⇒ Object
# === draw ========================================================================= #.
-
#initialize(x, y) ⇒ Paddle
constructor
# === initialize ========================================================================= #.
-
#reset ⇒ Object
# === reset ========================================================================= #.
-
#update(mx, my) ⇒ Object
# === update ========================================================================= #.
Constructor Details
#initialize(x, y) ⇒ Paddle
#
initialize
#
32 33 34 35 36 |
# File 'lib/games_and_rpg_paradise/gui/gtk3/block/paddle.rb', line 32 def initialize(x, y) @x = x @y = y reset end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
22 23 24 |
# File 'lib/games_and_rpg_paradise/gui/gtk3/block/paddle.rb', line 22 def height @height end |
#width ⇒ Object
Returns the value of attribute width.
21 22 23 |
# File 'lib/games_and_rpg_paradise/gui/gtk3/block/paddle.rb', line 21 def width @width end |
#x ⇒ Object
Returns the value of attribute x.
19 20 21 |
# File 'lib/games_and_rpg_paradise/gui/gtk3/block/paddle.rb', line 19 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
20 21 22 |
# File 'lib/games_and_rpg_paradise/gui/gtk3/block/paddle.rb', line 20 def y @y end |
Instance Method Details
#draw ⇒ Object
#
draw
#
67 68 69 70 71 72 73 74 75 |
# File 'lib/games_and_rpg_paradise/gui/gtk3/block/paddle.rb', line 67 def draw Nyle.draw_rect( @x, @y, @width, @height, **{color: :WHITE, fill: true} ) end |
#reset ⇒ Object
#
reset
#
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/games_and_rpg_paradise/gui/gtk3/block/paddle.rb', line 41 def reset # reset_the_internal_variables # ======================================================================= # # === @configuration # ======================================================================= # @configuration = [true, __dir__, inspect] # ======================================================================= # # === @width # ======================================================================= # set_width(WIDTH) # ======================================================================= # # === @height # ======================================================================= # @height = 20 end |
#update(mx, my) ⇒ Object
#
update
#
60 61 62 |
# File 'lib/games_and_rpg_paradise/gui/gtk3/block/paddle.rb', line 60 def update(mx, my) @x = mx - @width / 2 end |