MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / keyPress

Method keyPress

src/bzflag/ShotStatsDefaultKey.cpp:34–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34bool ShotStatsDefaultKey::keyPress(const BzfKeyEvent& key) {
35 // special keys to get out
36 switch (key.unicode) {
37 case 27: // escape
38 HUDDialogStack::get()->pop();
39 return true;
40 case 13: // return
41 HUDDialogStack::get()->top()->execute();
42 return true;
43 }
44 if (key.button == BzfKeyEvent::Home) {
45 HUDDialogStack::get()->pop();
46 return true;
47 }
48
49 // allow all commands to run
50 std::string keyCommand = KEYMGR.get(key, true);
51 if (keyCommand != "") {
52 CMDMGR.run(keyCommand);
53 return true;
54 }
55
56 // all other keys return
57 HUDDialogStack::get()->pop();
58 return true;
59}
60
61bool ShotStatsDefaultKey::keyRelease(const BzfKeyEvent& /* key */) {
62 return true;

Callers

nothing calls this directly

Calls 5

popMethod · 0.80
topMethod · 0.80
executeMethod · 0.45
getMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected