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

.moved ⇒ Boolean (readonly)

Get if the mouse moved since last frame

Returns:

  • (Boolean)


1217
1218
1219
# File 'docs/0_Dependencies.rb', line 1217

def moved
  @moved
end

.wheel ⇒ Integer

Mouse wheel position

Returns:

  • (Integer)


1205
1206
1207
# File 'docs/0_Dependencies.rb', line 1205

def wheel
  @wheel
end

.wheel_delta ⇒ Integer (readonly)

Mouse wheel delta

Returns:

  • (Integer)


1208
1209
1210
# File 'docs/0_Dependencies.rb', line 1208

def wheel_delta
  @wheel_delta
end

.x ⇒ Integer (readonly)

Get the mouse x position

Returns:

  • (Integer)


1211
1212
1213
# File 'docs/0_Dependencies.rb', line 1211

def x
  @x
end

.y ⇒ Integer (readonly)

Get the mouse y position

Returns:

  • (Integer)


1214
1215
1216
# File 'docs/0_Dependencies.rb', line 1214

def y
  @y
end

Class Method Details

.in? ⇒ Boolean

Tell if the mouse is in the screen

Returns:

  • (Boolean)


1235
1236
# File 'docs/0_Dependencies.rb', line 1235

def in?
end

.press?(button) ⇒ Boolean

Tell if a button is pressed on the mouse

Parameters:

  • button (Symbol)

Returns:

  • (Boolean)


1221
1222
# File 'docs/0_Dependencies.rb', line 1221

def press?(button)
end

.register_events(window)

Register event related to the mouse

Parameters:



1242
1243
# File 'docs/0_Dependencies.rb', line 1242

def register_events(window)
end

.released?(button) ⇒ Boolean

Tell if a button was released on the mouse

Parameters:

  • button (Symbol)

Returns:

  • (Boolean)


1231
1232
# File 'docs/0_Dependencies.rb', line 1231

def released?(button)
end

.swap_states

Swap the state of the mouse



1238
1239
# File 'docs/0_Dependencies.rb', line 1238

def swap_states
end

.trigger?(button) ⇒ Boolean

Tell if a button was triggered on the mouse

Parameters:

  • button (Symbol)

Returns:

  • (Boolean)


1226
1227
# File 'docs/0_Dependencies.rb', line 1226

def trigger?(button)
end