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

Function notifyBzfKeyMapChanged

src/bzflag/guiplaying.cpp:1254–1293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1252
1253
1254void notifyBzfKeyMapChanged() {
1255 std::string restartLabel = BundleMgr::getCurrentBundle()->getLocalString("Right Mouse");
1256 std::vector<std::string> keys = KEYMGR.getKeysFromCommand("restart", false);
1257
1258 if (keys.size() == 0) {
1259 // found nothing on down binding, so try up
1260 keys = KEYMGR.getKeysFromCommand("identify", true);
1261 if (keys.size() == 0) {
1262 std::cerr << "There does not appear to be any key bound to enter the game" << std::endl;
1263 }
1264 }
1265
1266 if (keys.size() >= 1) {
1267 // display single letter keys as a quoted lowercase letter
1268 if (keys[0].size() == 1) {
1269 restartLabel = '\"';
1270 restartLabel += tolower(keys[0][0]);
1271 restartLabel += '\"';
1272 }
1273 else {
1274 restartLabel = BundleMgr::getCurrentBundle()->getLocalString(keys[0]);
1275 }
1276 }
1277
1278 // only show the first 2 keys found to keep things simple
1279 if (keys.size() > 1) {
1280 restartLabel.append(BundleMgr::getCurrentBundle()->getLocalString(" or "));
1281 // display single letter keys as quoted lowercase letter
1282 if (keys[1].size() == 1) {
1283 restartLabel += '\"';
1284 restartLabel += tolower(keys[1][0]);
1285 restartLabel += '\"';
1286 }
1287 else {
1288 restartLabel.append(keys[1]);
1289 }
1290 }
1291
1292 hud->setRestartKeyLabel(restartLabel);
1293}
1294
1295
1296

Callers 2

startPlayingFunction · 0.70
dismissMethod · 0.70

Calls 6

tolowerFunction · 0.85
getLocalStringMethod · 0.80
getKeysFromCommandMethod · 0.80
setRestartKeyLabelMethod · 0.80
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected