ft2-clone

Fasttracker 2 clone
Log | Files | Refs | README | LICENSE

commit 46897c2079dd6b7f30dc76320ed3cf9d25214b22
parent c10569ad8bc61859e8d989a9eaf640c71f55c9d4
Author: Olav Sørensen <olav.sorensen@live.no>
Date:   Tue,  5 Apr 2022 19:32:27 +0200

Added checkbox for disabling custom FT2 mouse pointer

Diffstat:
Msrc/ft2_checkboxes.c | 1+
Msrc/ft2_checkboxes.h | 1+
Msrc/ft2_config.c | 32++++++++++++++++++++++++++++++--
Msrc/ft2_config.h | 4+++-
Msrc/ft2_header.h | 2+-
Msrc/ft2_mouse.c | 34++++++++++++++++++++++++++++++----
6 files changed, 66 insertions(+), 8 deletions(-)

diff --git a/src/ft2_checkboxes.c b/src/ft2_checkboxes.c @@ -90,6 +90,7 @@ checkBox_t checkBoxes[NUM_CHECKBOXES] = { 113, 79, 128, 12, cbConfigLineColors }, { 113, 92, 126, 12, cbConfigChanNums }, { 255, 14, 136, 12, cbConfigShowVolCol }, + { 237, 108, 13, 12, cbEnableCustomPointer }, { 255, 158, 111, 12, cbSoftwareMouse }, // --------------------------------- { 212, 2, 150, 12, cbSampCutToBuff }, diff --git a/src/ft2_checkboxes.h b/src/ft2_checkboxes.h @@ -65,6 +65,7 @@ enum // CHECKBOXES CB_CONF_LINECOLORS, CB_CONF_CHANNUMS, CB_CONF_SHOW_VOLCOL, + CB_CONF_ENABLE_CUSTOM_POINTER, CB_CONF_SOFTWARE_MOUSE, // CONFIG MISCELLANEOUS diff --git a/src/ft2_config.c b/src/ft2_config.c @@ -872,6 +872,7 @@ static void setConfigLayoutCheckButtonStates(void) checkBoxes[CB_CONF_LINECOLORS].checked = config.ptnLineLight; checkBoxes[CB_CONF_CHANNUMS].checked = config.ptnChnNumbers; checkBoxes[CB_CONF_SHOW_VOLCOL].checked = config.ptnShowVolColumn; + checkBoxes[CB_CONF_ENABLE_CUSTOM_POINTER].checked = (config.specialFlags2 & USE_OS_MOUSE_POINTER) ? false : true; checkBoxes[CB_CONF_SOFTWARE_MOUSE].checked = (config.specialFlags2 & HARDWARE_MOUSE) ? false : true; showCheckBox(CB_CONF_PATTSTRETCH); @@ -882,6 +883,7 @@ static void setConfigLayoutCheckButtonStates(void) showCheckBox(CB_CONF_LINECOLORS); showCheckBox(CB_CONF_CHANNUMS); showCheckBox(CB_CONF_SHOW_VOLCOL); + showCheckBox(CB_CONF_ENABLE_CUSTOM_POINTER); showCheckBox(CB_CONF_SOFTWARE_MOUSE); } @@ -1737,6 +1739,29 @@ void cbConfigShowVolCol(void) redrawPatternEditor(); } +void cbEnableCustomPointer(void) +{ + config.specialFlags2 ^= USE_OS_MOUSE_POINTER; + + if (config.specialFlags2 & USE_OS_MOUSE_POINTER) + { + checkBoxes[CB_CONF_ENABLE_CUSTOM_POINTER].checked = false; + drawCheckBox(CB_CONF_ENABLE_CUSTOM_POINTER); + } + else + { + checkBoxes[CB_CONF_ENABLE_CUSTOM_POINTER].checked = true; + drawCheckBox(CB_CONF_ENABLE_CUSTOM_POINTER); + } + + if (config.specialFlags2 & HARDWARE_MOUSE) + SDL_ShowCursor(SDL_TRUE); + else + SDL_ShowCursor(SDL_FALSE); + + createMouseCursors(); +} + void cbSoftwareMouse(void) { config.specialFlags2 ^= HARDWARE_MOUSE; @@ -1747,14 +1772,17 @@ void cbSoftwareMouse(void) { checkBoxes[CB_CONF_SOFTWARE_MOUSE].checked = false; drawCheckBox(CB_CONF_SOFTWARE_MOUSE); - SDL_ShowCursor(SDL_TRUE); } else { checkBoxes[CB_CONF_SOFTWARE_MOUSE].checked = true; drawCheckBox(CB_CONF_SOFTWARE_MOUSE); - SDL_ShowCursor(SDL_FALSE); } + + if (config.specialFlags2 & HARDWARE_MOUSE) + SDL_ShowCursor(SDL_TRUE); + else + SDL_ShowCursor(SDL_FALSE); } void rbConfigMouseNice(void) diff --git a/src/ft2_config.h b/src/ft2_config.h @@ -80,9 +80,10 @@ enum LINED_SCOPES = 128, // specialFlags2 - DITHERED_AUDIO = 1, /* DEPRECATED */ + DITHERED_AUDIO = 1, /* DEPRECATED (but don't use it for anything else!) */ HARDWARE_MOUSE = 2, STRETCH_IMAGE = 4, + USE_OS_MOUSE_POINTER = 8, // windowFlags WINSIZE_AUTO = 1, @@ -260,6 +261,7 @@ void cbConfigFramework(void); void cbConfigLineColors(void); void cbConfigChanNums(void); void cbConfigShowVolCol(void); +void cbEnableCustomPointer(void); void cbSoftwareMouse(void); void cbSampCutToBuff(void); void cbPattCutToBuff(void); diff --git a/src/ft2_header.h b/src/ft2_header.h @@ -12,7 +12,7 @@ #endif #include "ft2_replayer.h" -#define PROG_VER_STR "1.52" +#define PROG_VER_STR "1.53" // do NOT change these! It will only mess things up... diff --git a/src/ft2_mouse.c b/src/ft2_mouse.c @@ -32,6 +32,12 @@ static SDL_Cursor *cursors[NUM_CURSORS]; static bool setSystemCursor(SDL_Cursor *cur) { + if (config.specialFlags2 & USE_OS_MOUSE_POINTER) + { + SDL_SetCursor(SDL_GetDefaultCursor()); + return true; + } + if (cur == NULL) { SDL_SetCursor(SDL_GetDefaultCursor()); @@ -77,8 +83,18 @@ bool createMouseCursors(void) // creates scaled SDL surfaces for current mouse p if (surface == NULL) { freeMouseCursors(); - config.specialFlags2 &= ~HARDWARE_MOUSE; // enable software mouse - SDL_ShowCursor(SDL_FALSE); + + if (config.specialFlags2 & USE_OS_MOUSE_POINTER) + { + SDL_ShowCursor(SDL_TRUE); + } + else + { + // enable software mouse + config.specialFlags2 &= ~HARDWARE_MOUSE; + SDL_ShowCursor(SDL_FALSE); + } + return false; } @@ -148,8 +164,18 @@ bool createMouseCursors(void) // creates scaled SDL surfaces for current mouse p { SDL_FreeSurface(surface); freeMouseCursors(); - config.specialFlags2 &= ~HARDWARE_MOUSE; // enable software mouse - SDL_ShowCursor(SDL_FALSE); + + if (config.specialFlags2 & USE_OS_MOUSE_POINTER) + { + SDL_ShowCursor(SDL_TRUE); + } + else + { + // enable software mouse + config.specialFlags2 &= ~HARDWARE_MOUSE; + SDL_ShowCursor(SDL_FALSE); + } + return false; }