Skip to content

Commit a497baa

Browse files
committed
implement video::showMessage
1 parent 7789b99 commit a497baa

9 files changed

+2023
-12
lines changed

src/Application.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,7 @@ void Application::resetGame()
13291329

13301330
_core.resetGame();
13311331
_video.clear();
1332+
_video.showMessage("Reset", 60);
13321333
refreshMemoryMap();
13331334
RA_OnReset();
13341335
}
@@ -1781,6 +1782,10 @@ void Application::saveState(unsigned ndx)
17811782
return;
17821783
}
17831784

1785+
char message[128];
1786+
snprintf(message, sizeof(message), "Saved state %u", ndx);
1787+
_video.showMessage(message, 60);
1788+
17841789
_validSlots |= 1 << ndx;
17851790
enableSlots();
17861791
}
@@ -1816,6 +1821,10 @@ void Application::loadState(unsigned ndx)
18161821

18171822
if (_states.loadState(ndx))
18181823
{
1824+
char message[128];
1825+
snprintf(message, sizeof(message), "Loaded state %u", ndx);
1826+
_video.showMessage(message, 60);
1827+
18191828
updateDiscMenu(false);
18201829
}
18211830
}
@@ -1838,6 +1847,13 @@ void Application::loadState()
18381847
}
18391848
}
18401849

1850+
void Application::changeCurrentState(unsigned ndx)
1851+
{
1852+
char message[128];
1853+
snprintf(message, sizeof(message), "Current state set to %u", ndx);
1854+
_video.showMessage(message, 60);
1855+
}
1856+
18411857
void Application::screenshot()
18421858
{
18431859
if (!isGameActive())
@@ -1859,6 +1875,8 @@ void Application::screenshot()
18591875
std::string path = getScreenshotPath();
18601876
util::saveImage(&_logger, path, data, width, height, pitch, format);
18611877
free((void*)data);
1878+
1879+
_video.showMessage("Screenshot captured", 60);
18621880
}
18631881

18641882
void Application::aboutDialog()
@@ -2517,6 +2535,7 @@ void Application::handle(const KeyBinds::Action action, unsigned extra)
25172535
// State management
25182536
case KeyBinds::Action::kSaveState: saveState(extra); break;
25192537
case KeyBinds::Action::kLoadState: loadState(extra); break;
2538+
case KeyBinds::Action::kChangeCurrentState: changeCurrentState(extra); break;
25202539

25212540
// Window size
25222541
case KeyBinds::Action::kSetWindowSize1: resizeWindow(1); break;
@@ -2585,6 +2604,8 @@ void Application::handle(const KeyBinds::Action action, unsigned extra)
25852604

25862605
case KeyBinds::Action::kGameFocusToggle:
25872606
updateMenu();
2607+
2608+
_video.showMessage(_keybinds.hasGameFocus() ? "Game focus enabled" : "Game focus disabled", 60);
25882609
break;
25892610
}
25902611
}

src/Application.h

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class Application
110110
void loadState(const std::string& path);
111111
void loadState(unsigned ndx);
112112
void loadState();
113+
void changeCurrentState(unsigned ndx);
113114
void screenshot();
114115
void aboutDialog();
115116
void resizeWindow(unsigned multiplier);

src/KeyBinds.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -407,18 +407,18 @@ KeyBinds::Action KeyBinds::translateButtonPress(int button, unsigned* extra)
407407
case kLoadState8: *extra = 8; return Action::kLoadState;
408408
case kLoadState9: *extra = 9; return Action::kLoadState;
409409
case kLoadState10: *extra = 10; return Action::kLoadState;
410-
case kPreviousSlot: _slot = (_slot == 1) ? 10 : _slot - 1; return Action::kNothing;
411-
case kNextSlot: _slot = (_slot == 10) ? 1 : _slot + 1; return Action::kNothing;
412-
case kSetSlot1: _slot = 1; return Action::kNothing;
413-
case kSetSlot2: _slot = 2; return Action::kNothing;
414-
case kSetSlot3: _slot = 3; return Action::kNothing;
415-
case kSetSlot4: _slot = 4; return Action::kNothing;
416-
case kSetSlot5: _slot = 5; return Action::kNothing;
417-
case kSetSlot6: _slot = 6; return Action::kNothing;
418-
case kSetSlot7: _slot = 7; return Action::kNothing;
419-
case kSetSlot8: _slot = 8; return Action::kNothing;
420-
case kSetSlot9: _slot = 9; return Action::kNothing;
421-
case kSetSlot10: _slot = 10; return Action::kNothing;
410+
case kPreviousSlot: *extra = _slot = (_slot == 1) ? 10 : _slot - 1; return Action::kChangeCurrentState;
411+
case kNextSlot: *extra = _slot = (_slot == 10) ? 1 : _slot + 1; return Action::kChangeCurrentState;
412+
case kSetSlot1: *extra = _slot = 1; return Action::kChangeCurrentState;
413+
case kSetSlot2: *extra = _slot = 2; return Action::kChangeCurrentState;
414+
case kSetSlot3: *extra = _slot = 3; return Action::kChangeCurrentState;
415+
case kSetSlot4: *extra = _slot = 4; return Action::kChangeCurrentState;
416+
case kSetSlot5: *extra = _slot = 5; return Action::kChangeCurrentState;
417+
case kSetSlot6: *extra = _slot = 6; return Action::kChangeCurrentState;
418+
case kSetSlot7: *extra = _slot = 7; return Action::kChangeCurrentState;
419+
case kSetSlot8: *extra = _slot = 8; return Action::kChangeCurrentState;
420+
case kSetSlot9: *extra = _slot = 9; return Action::kChangeCurrentState;
421+
case kSetSlot10: *extra = _slot = 10; return Action::kChangeCurrentState;
422422
case kLoadCurrent: *extra = _slot; return Action::kLoadState;
423423
case kSaveCurrent: *extra = _slot; return Action::kSaveState;
424424

src/KeyBinds.h

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class KeyBinds
6262
// State state management (extra = slot)
6363
kSaveState,
6464
kLoadState,
65+
kChangeCurrentState,
6566

6667
// Window size
6768
kSetWindowSize1,

0 commit comments

Comments
 (0)