Gama C Library
Gama C API Documentation
mouse.h
Go to the documentation of this file.
1#pragma once
2
3#include "position.h"
4#include <stdint.h>
5
6/**
7 * @brief Structure representing the current state of the mouse.
8 *
9 * This struct holds various properties related to mouse input, including
10 * its position, movement, and button click states.
11 */
12struct _gmMouse {
13 gmPos position; /**< The current X,Y coordinates of the mouse. */
14 gmPos lastPosition; /**< The X,Y coordinates of the mouse in the previous frame. */
15 gmPos movement; /**< The change in mouse position since the last frame. */
16
17 uint8_t clicked; /**< True (1) if the mouse button was just pressed in this frame, otherwise false (0). */
18 uint8_t down; /**< True (1) if the mouse button is currently held down, otherwise false (0). */
19};
20
21/**
22 * @brief Global instance of the mouse state.
23 *
24 * This variable is updated automatically by the engine and provides
25 * access to the current mouse input.
26 * @example
27 * if (gm_mouse.clicked) {
28 * // Mouse was just clicked
29 * }
30 * double mx = gm_mouse.position.x;
31 */
33 .position = {0, 0},
34 .lastPosition = {0, 0},
35 .movement = {0, 0},
36 .clicked = 0,
37 .down = 0,
38};
struct _gmMouse gm_mouse
Definition mouse.h:32
Structure representing the current state of the mouse.
Definition mouse.h:12
uint8_t down
Definition mouse.h:18
gmPos position
Definition mouse.h:13
gmPos movement
Definition mouse.h:15
uint8_t clicked
Definition mouse.h:17
gmPos lastPosition
Definition mouse.h:14
Represents a 2D position or vector.
Definition position.h:8