Class: GamesParadise::Cursor
- Inherits:
-
Object
- Object
- GamesParadise::Cursor
- Defined in:
- lib/games_paradise/gui/gosu/aero_exploder/cursor.rb
Instance Attribute Summary collapse
-
#cur_x ⇒ Object
Returns the value of attribute cur_x.
-
#cur_y ⇒ Object
Returns the value of attribute cur_y.
Instance Method Summary collapse
-
#button_down(id) ⇒ Object
# === button_down ========================================================================= #.
-
#draw ⇒ Object
# === draw ========================================================================= #.
-
#initialize(parent_widget) ⇒ Cursor
constructor
# === initialize ========================================================================= #.
-
#reset ⇒ Object
# === reset ========================================================================= #.
-
#update(mouse_x, mouse_y) ⇒ Object
# === update ========================================================================= #.
Constructor Details
#initialize(parent_widget) ⇒ Cursor
#
initialize
#
17 18 19 20 |
# File 'lib/games_paradise/gui/gosu/aero_exploder/cursor.rb', line 17 def initialize() @parent_widget = reset end |
Instance Attribute Details
#cur_x ⇒ Object
Returns the value of attribute cur_x.
11 12 13 |
# File 'lib/games_paradise/gui/gosu/aero_exploder/cursor.rb', line 11 def cur_x @cur_x end |
#cur_y ⇒ Object
Returns the value of attribute cur_y.
12 13 14 |
# File 'lib/games_paradise/gui/gosu/aero_exploder/cursor.rb', line 12 def cur_y @cur_y end |
Instance Method Details
#button_down(id) ⇒ Object
#
button_down
#
48 49 50 51 52 53 54 55 |
# File 'lib/games_paradise/gui/gosu/aero_exploder/cursor.rb', line 48 def (id) case id when ::Gosu::MsLeft # Left-mouse button click. @parent_widget.deduct_one_bullet # This can not go below 0. @cur_smp.play if @parent_widget.any_bullets_left? @sound_when_there_are_no_bullets_Left.play if @parent_widget.n_bullets? <= 0 end end |
#draw ⇒ Object
#
draw
#
60 61 62 |
# File 'lib/games_paradise/gui/gosu/aero_exploder/cursor.rb', line 60 def draw @cur_img.draw(@cur_x, @cur_y, 10) end |
#reset ⇒ Object
#
reset
#
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/games_paradise/gui/gosu/aero_exploder/cursor.rb', line 25 def reset # ======================================================================= # # === @cur_x # ======================================================================= # @cur_x = 0 @cur_y = 0 @cur_img = ::Gosu::Image.new('data/cursor_img.png') @cur_smp = ::Gosu::Sample.new('data/cursor.wav') # === @sound_when_there_are_no_bullets_Left @sound_when_there_are_no_bullets_Left = ::Gosu::Sample.new('data/empty.ogg') end |
#update(mouse_x, mouse_y) ⇒ Object
#
update
#
40 41 42 43 |
# File 'lib/games_paradise/gui/gosu/aero_exploder/cursor.rb', line 40 def update(mouse_x, mouse_y) @cur_x = mouse_x - @cur_img.width / 2 @cur_y = mouse_y - @cur_img.height / 2 end |