MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / OnKeyPress

Method OnKeyPress

src/highscore_gui.cpp:82–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80 }
81
82 EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override
83 {
84 /* All keys are 'handled' by this window but we want to make
85 * sure that 'quit' still works correctly. Not handling the
86 * quit key is enough so the main toolbar can handle it. */
87 if (IsQuitKey(keycode)) return ES_NOT_HANDLED;
88
89 switch (keycode) {
90 /* Keys for telling we want to go on */
91 case WKC_RETURN:
92 case WKC_ESC:
93 case WKC_SPACE:
94 this->Close();
95 return ES_HANDLED;
96
97 default:
98 /* We want to handle all keys; we don't want windows in
99 * the background to open. Especially the ones that do
100 * locate themselves based on the status-/toolbars. */
101 return ES_HANDLED;
102 }
103 }
104};
105
106/** End game window shown at the end of the game */

Callers

nothing calls this directly

Calls 2

IsQuitKeyFunction · 0.85
CloseMethod · 0.45

Tested by

no test coverage detected