FlixelMouseManager
View sourceclass
org.flixelgdx.input.mouse.FlixelMouseManager
Mouse and pointer polling with screen/world coordinates. Access via Flixel.mouse after Flixel.initialize(FlixelGame).
Scroll wheel deltas
InputProcessor.scrolled(...) supplies amountX and amountY from libGDX. This manager accumulates them into FlixelMouseManager.getScrollDeltaX() and FlixelMouseManager.getScrollDeltaY() until FlixelMouseManager.endFrame().
- FlixelMouseManager.getScrollDeltaX(): horizontal scroll (e.g. trackpad sideways, some Shift+wheel setups). Not the usual mouse-wheel up/down axis. This is typically used by trackpad users for horizontal scrolling.
- FlixelMouseManager.getScrollDeltaY(): vertical scroll. This is what you normally use for standard wheel up/down. You'll most likely use this a lot of the time.
Values are deltas, not fixed -1/1: magnitude varies by device (notched wheel vs trackpad, high-resolution wheels). The sign indicates direction, but which sign means "up" vs "down" can depend on the backend/OS; verify on your target platform if input feels inverted.
Read accumulated scroll after FlixelMouseManager.update() and before FlixelMouseManager.endFrame() clears it (same timing as other per-frame input you consume in your game loop).
Constructors
FlixelMouseManager()
Fields
icons
enabled
When false, all queries return inactive state.
Methods
setMouseIconManager(FlixelMouseIconManager)
Replaces the active FlixelMouseIconManager, for example with an LWJGL3 or web backend. Pass null to force the shared no-op implementation.
Parameters:
| Name | Description |
|---|---|
iconManager | The FlixelMouseIconManager to implement. |
getInputProcessor()
update()
Call once per frame at the start of the game update (with Flixel.keys).
setWorldCamera(FlixelCamera)
Sets the camera for world coordinates; null uses Flixel.cameras.
getWorldCamera()
endFrame()
Call at end of frame after game logic (with FlixelKeyInputManager.endFrame()). Resets FlixelMouseManager.getScrollDeltaX() and FlixelMouseManager.getScrollDeltaY() to zero for the next frame.
getScreenX()
getScreenY()
getWorldX()
getWorldY()
getWorldX(FlixelCamera)
getWorldY(FlixelCamera)
getScrollDeltaX()
Sum of horizontal scroll amounts received this frame via InputProcessor.scrolled(...) amountX (not cleared until FlixelMouseManager.endFrame()). Use for sideways scroll; for typical wheel up/down use FlixelMouseManager.getScrollDeltaY().
getScrollDeltaY()
Sum of vertical scroll amounts received this frame via InputProcessor.scrolled(...) amountY (not cleared until FlixelMouseManager.endFrame()). Sign and magnitude are device-dependent; see class Javadoc.
pressed(int)
Returns whether the given mouse button is held down. Returns false while the active debug overlay reports that another UI layer (typically the imgui debugger) is capturing mouse input, so clicking inside an imgui window cannot leak into game logic.
Use FlixelMouseManager.rawPressed(int) when you specifically need the raw, unsuppressed state. The debug overlay's own sprite picker / camera tools use the raw variants so they can opt in to "ignore the suppression" when needed.
Parameters:
| Name | Description |
|---|---|
button | libGDX button index (e.g. 0 for left mouse button). |
Returns: true if the button is pressed and input is enabled and not suppressed by UI.
rawPressed(int)
Same as FlixelMouseManager.pressed(int) but bypasses the "captured by debug UI" check.
Parameters:
| Name | Description |
|---|---|
button | libGDX button index. |
Returns: true if the button is pressed and input is enabled, regardless of UI capture.
justPressed(int)
Returns whether the given mouse button was just pressed this frame. Returns false while the debug UI reports that another UI layer is capturing mouse input.
Parameters:
| Name | Description |
|---|---|
button | libGDX button index. |
Returns: true if the button was just pressed and input is enabled and not suppressed.
rawJustPressed(int)
Same as FlixelMouseManager.justPressed(int) but bypasses the "captured by debug UI" check.
Parameters:
| Name | Description |
|---|---|
button | libGDX button index. |
Returns: true if the button was just pressed and input is enabled, regardless of UI capture.
justReleased(int)
Returns whether the given mouse button was just released this frame. Returns false while the debug UI reports that another UI layer is capturing mouse input.
Parameters:
| Name | Description |
|---|---|
button | libGDX button index. |
Returns: true if the button was just released and input is enabled and not suppressed.
rawJustReleased(int)
Same as FlixelMouseManager.justReleased(int) but bypasses the "captured by debug UI" check.
Parameters:
| Name | Description |
|---|---|
button | libGDX button index. |
Returns: true if the button was just released and input is enabled, regardless of UI capture.