From ec0c6ad9060b984c4ae916537af048d5f6e1920e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 30 Jun 2023 14:50:47 +0900 Subject: [PATCH] [vid] Add an api function to control mouse visibility It's currently very simplistic (visible, not visible), but it gets things started for making QF more usable in a windowed environment (not having a visible cursor was fine in DOS, or when full screen, but not when windowed (and not actively playing). --- include/QF/vid.h | 1 + include/vid_internal.h | 1 + libs/video/targets/vid.c | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/include/QF/vid.h b/include/QF/vid.h index 7f15de0e8..757bd2adf 100644 --- a/include/QF/vid.h +++ b/include/QF/vid.h @@ -73,6 +73,7 @@ void VID_Init_Cvars (void); void VID_Init (byte *palette, byte *colormap); void VID_SetPalette (byte *palette, byte *colormap); void VID_SetCaption (const char *text); +void VID_SetCursor (bool visible); void VID_ClearMemory (void); void VID_OnPaletteChange_AddListener (viddef_listener_t listener, void *data); diff --git a/include/vid_internal.h b/include/vid_internal.h index ea45d2a13..d99a57525 100644 --- a/include/vid_internal.h +++ b/include/vid_internal.h @@ -10,6 +10,7 @@ typedef struct vid_system_s { void (*set_palette) (byte *palette, byte *colormap); void (*init_cvars) (void); void (*update_fullscreen) (int fullscreen); + void (*set_cursor) (bool visible); } vid_system_t; extern vid_system_t vid_system; diff --git a/libs/video/targets/vid.c b/libs/video/targets/vid.c index 825433180..56195010c 100644 --- a/libs/video/targets/vid.c +++ b/libs/video/targets/vid.c @@ -351,6 +351,14 @@ VID_SetPalette (byte *palette, byte *colormap) vid_system.set_palette (palette, colormap); } +VISIBLE void +VID_SetCursor (bool visible) +{ + if (vid_system.set_cursor) { + vid_system.set_cursor (visible); + } +} + static void vid_fullscreen_f (void *data, const cvar_t *var) {