From 420970c8b83f20a4a2411af687e9d4a38a5fe81a Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Mon, 16 Sep 2024 19:56:36 -0700 Subject: Add function to query mouse buttons. --- app/include/gfx/app.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'app/include') diff --git a/app/include/gfx/app.h b/app/include/gfx/app.h index 3843d92..77b6ad2 100644 --- a/app/include/gfx/app.h +++ b/app/include/gfx/app.h @@ -31,6 +31,12 @@ typedef struct GfxAppCallbacks { GfxAppResize resize; } GfxAppCallbacks; +typedef enum MouseButton { + LMB, + RMB, + MMB, +} MouseButton; + typedef enum Key { KeyA = 'a', KeyB, @@ -70,8 +76,11 @@ bool gfx_app_run(const GfxAppDesc*, const GfxAppCallbacks*); /// Get the mouse coordinates relative to the app's window. void gfx_app_get_mouse_position(double* x, double* y); +/// Return if the given mouse button is pressed. +bool gfx_app_is_mouse_button_pressed(MouseButton); + /// Return true if the given key is pressed. -bool gfx_is_key_pressed(Key); +bool gfx_app_is_key_pressed(Key); #ifdef __cplusplus } // extern "C" -- cgit v1.2.3