Module: RbSDL2::Mouse::MouseButton

Included in:
RbSDL2::Mouse, MouseClass
Defined in:
lib/rb_sdl2/mouse/mouse_button.rb

Constant Summary collapse

BUTTON =
-> (x) { 1 << x - 1 }
BUTTON_LMASK =
BUTTON.(::SDL::BUTTON_LEFT)
BUTTON_MMASK =
BUTTON.(::SDL::BUTTON_MIDDLE)
BUTTON_RMASK =
BUTTON.(::SDL::BUTTON_RIGHT)
BUTTON_X1MASK =
BUTTON.(::SDL::BUTTON_X1)
BUTTON_X2MASK =
BUTTON.(::SDL::BUTTON_X2)

Instance Method Summary collapse

Instance Method Details

#any_button?Boolean

Returns:

  • (Boolean)


13
# File 'lib/rb_sdl2/mouse/mouse_button.rb', line 13

def any_button? = button != 0

#button?(mask) ⇒ Boolean

Returns:

  • (Boolean)


11
# File 'lib/rb_sdl2/mouse/mouse_button.rb', line 11

def button?(mask) = mask & button != 0

#left_button?Boolean

Returns:

  • (Boolean)


15
# File 'lib/rb_sdl2/mouse/mouse_button.rb', line 15

def left_button? = button?(BUTTON_LMASK)

#middle_button?Boolean

Returns:

  • (Boolean)


17
# File 'lib/rb_sdl2/mouse/mouse_button.rb', line 17

def middle_button? = button?(BUTTON_MMASK)

#right_button?Boolean

Returns:

  • (Boolean)


19
# File 'lib/rb_sdl2/mouse/mouse_button.rb', line 19

def right_button? = button?(BUTTON_RMASK)

#x1_button?Boolean

Returns:

  • (Boolean)


21
# File 'lib/rb_sdl2/mouse/mouse_button.rb', line 21

def x1_button? = button?(BUTTON_X1MASK)

#x2_button?Boolean

Returns:

  • (Boolean)


23
# File 'lib/rb_sdl2/mouse/mouse_button.rb', line 23

def x2_button? = button?(BUTTON_X2MASK)