Skip to content

Commit f9dc350

Browse files
authored
add Game Focus indicator to titlebar (#336)
1 parent b5ea83e commit f9dc350

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/Application.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,8 @@ void Application::updateMenu()
965965
else if (isGameActive())
966966
{
967967
char msg[256];
968-
snprintf(msg, sizeof(msg), "%s %s - %s", _core.getSystemInfo()->library_name, _core.getSystemInfo()->library_version, getSystemName(_system));
968+
snprintf(msg, sizeof(msg), "%s %s - %s%s", _core.getSystemInfo()->library_name, _core.getSystemInfo()->library_version,
969+
getSystemName(_system), _keybinds.hasGameFocus() ? " [Game Focus]" : "");
969970
RA_UpdateAppTitle(msg);
970971
}
971972
else
@@ -2474,6 +2475,10 @@ void Application::handle(const KeyBinds::Action action, unsigned extra)
24742475
case KeyBinds::Action::kKeyboardInput:
24752476
_input.keyboardEvent(static_cast<enum retro_key>(extra >> 8), static_cast<bool>(extra & 0xFF));
24762477
break;
2478+
2479+
case KeyBinds::Action::kGameFocusToggle:
2480+
updateMenu();
2481+
break;
24772482
}
24782483
}
24792484

src/KeyBinds.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ KeyBinds::Action KeyBinds::translateButtonPress(int button, unsigned* extra)
382382
case kScreenshot: return Action::kScreenshot;
383383

384384
// Game Focus
385-
case kGameFocusToggle: _gameFocus = !_gameFocus; return Action::kNothing;
385+
case kGameFocusToggle: _gameFocus = !_gameFocus; return Action::kGameFocusToggle;
386386

387387
default: return Action::kNothing;
388388
}

src/KeyBinds.h

+3
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class KeyBinds
8686
kReset,
8787

8888
// Keyboard
89+
kGameFocusToggle,
8990
kKeyboardInput // (extra = key << 8 | pressed)
9091
};
9192

@@ -125,6 +126,8 @@ class KeyBinds
125126
std::string serializeBindings() const;
126127
bool deserializeBindings(const char* json);
127128

129+
bool hasGameFocus() const noexcept { return _gameFocus; }
130+
128131
protected:
129132
libretro::LoggerComponent* _logger;
130133

0 commit comments

Comments
 (0)