imgui/renderer: Hide Cursor on Idle Implementation (#1266)

Implement hide cursor on idle w/ idle timeout duration (configurable via GUI). While at it add always and never to hide the cursor options as well.

* Revert commit #1211 as to not interfere with the cursor states.
* Make hide cursor on idle as the default setting w/ timeout duration of 5 seconds to hide.
* Add an input tab in the settings page to add the hide cursor setting, with hiding the idle timeout box with respect to the cursor hide option.

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
This commit is contained in:
Exhigh 2024-10-08 10:47:42 +04:00 committed by GitHub
parent 96344873d6
commit f139762c64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 296 additions and 12 deletions

View file

@ -57,6 +57,8 @@ static bool vkValidationGpu = false;
static bool rdocEnable = false;
static bool vkMarkers = false;
static bool vkCrashDiagnostic = false;
static s16 cursorState = HideCursorState::Idle;
static int cursorHideTimeout = 5; // 5 seconds (default)
// Gui
std::filesystem::path settings_install_dir = {};
@ -96,6 +98,14 @@ int getBGMvolume() {
return BGMvolume;
}
s16 getCursorState() {
return cursorState;
}
int getCursorHideTimeout() {
return cursorHideTimeout;
}
u32 getScreenWidth() {
return screenWidth;
}
@ -256,6 +266,14 @@ void setBGMvolume(int volume) {
BGMvolume = volume;
}
void setCursorState(s16 newCursorState) {
cursorState = newCursorState;
}
void setCursorHideTimeout(int newcursorHideTimeout) {
cursorHideTimeout = newcursorHideTimeout;
}
void setLanguage(u32 language) {
m_language = language;
}
@ -450,6 +468,8 @@ void load(const std::filesystem::path& path) {
if (data.contains("Input")) {
const toml::value& input = data.at("Input");
cursorState = toml::find_or<int>(input, "cursorState", HideCursorState::Idle);
cursorHideTimeout = toml::find_or<int>(input, "cursorHideTimeout", 5);
useSpecialPad = toml::find_or<bool>(input, "useSpecialPad", false);
specialPadClass = toml::find_or<int>(input, "specialPadClass", 1);
}
@ -543,6 +563,8 @@ void save(const std::filesystem::path& path) {
data["General"]["updateChannel"] = updateChannel;
data["General"]["showSplash"] = isShowSplash;
data["General"]["autoUpdate"] = isAutoUpdate;
data["Input"]["cursorState"] = cursorState;
data["Input"]["cursorHideTimeout"] = cursorHideTimeout;
data["General"]["backButtonBehavior"] = backButtonBehavior;
data["Input"]["useSpecialPad"] = useSpecialPad;
data["Input"]["specialPadClass"] = specialPadClass;
@ -592,6 +614,8 @@ void setDefaultValues() {
isFullscreen = false;
playBGM = false;
BGMvolume = 50;
cursorState = HideCursorState::Idle;
cursorHideTimeout = 5;
screenWidth = 1280;
screenHeight = 720;
logFilter = "";