Class: RbSDL2::Mouse::MouseClass

Inherits:
Object
  • Object
show all
Includes:
MouseButton
Defined in:
lib/rb_sdl2/mouse/mouse_class.rb

Direct Known Subclasses

GlobalMouse, RelativeMouse

Constant Summary

Constants included from MouseButton

RbSDL2::Mouse::MouseButton::BUTTON, RbSDL2::Mouse::MouseButton::BUTTON_LMASK, RbSDL2::Mouse::MouseButton::BUTTON_MMASK, RbSDL2::Mouse::MouseButton::BUTTON_RMASK, RbSDL2::Mouse::MouseButton::BUTTON_X1MASK, RbSDL2::Mouse::MouseButton::BUTTON_X2MASK

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MouseButton

#any_button?, #button?, #left_button?, #middle_button?, #right_button?, #x1_button?, #x2_button?

Constructor Details

#initializeMouseClass

Returns a new instance of MouseClass.



4
5
6
7
# File 'lib/rb_sdl2/mouse/mouse_class.rb', line 4

def initialize(*)
  @button = @x = @y = 0
  update
end

Instance Attribute Details

#buttonObject

Returns the value of attribute button.



9
10
11
# File 'lib/rb_sdl2/mouse/mouse_class.rb', line 9

def button
  @button
end

#xObject

Returns the value of attribute x.



9
10
11
# File 'lib/rb_sdl2/mouse/mouse_class.rb', line 9

def x
  @x
end

#yObject

Returns the value of attribute y.



9
10
11
# File 'lib/rb_sdl2/mouse/mouse_class.rb', line 9

def y
  @y
end

Instance Method Details

#positionObject



14
# File 'lib/rb_sdl2/mouse/mouse_class.rb', line 14

def position = [x, y]

#position=(x_y) ⇒ Object



16
17
18
# File 'lib/rb_sdl2/mouse/mouse_class.rb', line 16

def position=(x_y)
  self.x, self.y = x_y
end

#updateObject

継承先のクラスではこのメソッドをオーバーライドすること。 戻り値は self が戻ることが期待されている。

Raises:

  • (NotImplementedError)


22
# File 'lib/rb_sdl2/mouse/mouse_class.rb', line 22

def update = raise NotImplementedError