Module: Mouse

Defined in:
docs/0_Dependencies.rb

Overview

The buttons of the mouse are : :LEFT, :MIDDLE, :RIGHT, :X1, :X2

Constant Summary collapse

BUTTON_MAPPING =

Mapping between button & symbols

{Sf::Mouse::LEFT => :LEFT, Sf::Mouse::RIGHT => :RIGHT, Sf::Mouse::Middle => :MIDDLE, Sf::Mouse::XButton1 => :X1, Sf::Mouse::XButton2 => :X2}
BUTTON_ALIAS =

List of alias button

{left: :LEFT, right: :RIGHT, middle: :MIDDLE}

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.movedBoolean (readonly)

Get if the mouse moved since last frame

Returns:

  • (Boolean)


1070
1071
1072
# File 'docs/0_Dependencies.rb', line 1070

def moved
  @moved
end

.wheelInteger

Mouse wheel position

Returns:

  • (Integer)


1058
1059
1060
# File 'docs/0_Dependencies.rb', line 1058

def wheel
  @wheel
end

.wheel_deltaInteger (readonly)

Mouse wheel delta

Returns:

  • (Integer)


1061
1062
1063
# File 'docs/0_Dependencies.rb', line 1061

def wheel_delta
  @wheel_delta
end

.xInteger (readonly)

Get the mouse x position

Returns:

  • (Integer)


1064
1065
1066
# File 'docs/0_Dependencies.rb', line 1064

def x
  @x
end

.yInteger (readonly)

Get the mouse y position

Returns:

  • (Integer)


1067
1068
1069
# File 'docs/0_Dependencies.rb', line 1067

def y
  @y
end

Class Method Details

.in?Boolean

Tell if the mouse is in the screen

Returns:

  • (Boolean)


1088
1089
# File 'docs/0_Dependencies.rb', line 1088

def in?
end

.press?(button) ⇒ Boolean

Tell if a button is pressed on the mouse

Parameters:

  • button (Symbol)

Returns:

  • (Boolean)


1074
1075
# File 'docs/0_Dependencies.rb', line 1074

def press?(button)
end

.register_events(window)

Register event related to the mouse

Parameters:



1095
1096
# File 'docs/0_Dependencies.rb', line 1095

def register_events(window)
end

.released?(button) ⇒ Boolean

Tell if a button was released on the mouse

Parameters:

  • button (Symbol)

Returns:

  • (Boolean)


1084
1085
# File 'docs/0_Dependencies.rb', line 1084

def released?(button)
end

.swap_states

Swap the state of the mouse



1091
1092
# File 'docs/0_Dependencies.rb', line 1091

def swap_states
end

.trigger?(button) ⇒ Boolean

Tell if a button was triggered on the mouse

Parameters:

  • button (Symbol)

Returns:

  • (Boolean)


1079
1080
# File 'docs/0_Dependencies.rb', line 1079

def trigger?(button)
end