LibGame  v0.4.0
The LG Game Engine - Copyright (C) 2024-2025 ETMSoftware
lg_mouse.c File Reference

Functions

zboolean lg_mouse_get_state (SDL_Event event, zboolean *left_click, zboolean *right_click, int *dx, int *dy, int *dz_wheel)
 
int lg_mouse_override_delta_threshold (int new_threshold)
 

Detailed Description

 === Mouse-related stuff ===

Function Documentation

◆ lg_mouse_get_state()

zboolean lg_mouse_get_state ( SDL_Event  event,
zboolean *  left_click,
zboolean *  right_click,
int *  dx,
int *  dy,
int *  dz_wheel 
)

Get mouse inputs: left/right click, delta x/y since last call IF left or right button is pressed, wheel actions since last call

=== This is the func you can/should use to get mouse inputs inside the game main loop ===

Does NOT invoke SDL_PollEvent()

Parameters
eventA SDL_Event
left_clickPointer to zboolean that will get left clicks
right_clickPointer to zboolean that will get right clicks
dxPointer to int that will get delta x since last call
dyPointer to int that will get delta y since last call
dz_wheelPointer to int that will get delta z (wheel forward/backward motions) since last call
Returns
TRUE if there was some mouse activity, FALSE otherwise

◆ lg_mouse_override_delta_threshold()

int lg_mouse_override_delta_threshold ( int  new_threshold)

Override mouse delta threshold

Default value is MOUSE_DELTA_THRESHOLD defined in lg_mouse.h

Parameters
new_threshold
Returns
LG_OK if OK, LG_ERROR if new_threshold is < 1