Class: RbSDL2::Mouse::GlobalMouse
- Inherits:
-
MouseClass
- Object
- MouseClass
- RbSDL2::Mouse::GlobalMouse
- Defined in:
- lib/rb_sdl2/mouse/global_mouse.rb
Constant Summary
Constants included from MouseButton
MouseButton::BUTTON, MouseButton::BUTTON_LMASK, MouseButton::BUTTON_MMASK, MouseButton::BUTTON_RMASK, MouseButton::BUTTON_X1MASK, MouseButton::BUTTON_X2MASK
Instance Attribute Summary
Attributes inherited from MouseClass
Instance Method Summary collapse
-
#initialize ⇒ GlobalMouse
constructor
A new instance of GlobalMouse.
- #position=(x_y) ⇒ Object
- #update ⇒ Object
Methods inherited from MouseClass
Methods included from MouseButton
#any_button?, #button?, #left_button?, #middle_button?, #right_button?, #x1_button?, #x2_button?
Constructor Details
#initialize ⇒ GlobalMouse
Returns a new instance of GlobalMouse.
6 7 8 9 10 |
# File 'lib/rb_sdl2/mouse/global_mouse.rb', line 6 def initialize @_x = ::FFI::MemoryPointer.new(:int) @_y = ::FFI::MemoryPointer.new(:int) super end |
Instance Method Details
#position=(x_y) ⇒ Object
12 13 14 15 16 |
# File 'lib/rb_sdl2/mouse/global_mouse.rb', line 12 def position=(x_y) err = ::SDL.WarpMouseGlobal(*x_y) raise RbSDL2Error if err < 0 super end |
#update ⇒ Object
18 19 20 21 22 |
# File 'lib/rb_sdl2/mouse/global_mouse.rb', line 18 def update self., self.x, self.y = ::SDL.GetGlobalMouseState(@_x, @_y), @_x.read_int, @_y.read_int self end |