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

Method callback

src/bzflag/TextOptionsMenu.cpp:253–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251
252
253void TextOptionsMenu::callback(HUDuiControl* w, void* data) {
254 HUDuiList* list = (HUDuiList*)w;
255
256 switch (((const char*)data)[0]) {
257 case 'L': {
258 std::vector<std::string>* options = &list->getList();
259 std::string locale = (*options)[list->getIndex()];
260
261 World::setLocale(locale);
262 BZDB.set("locale", locale);
263 World::getBundleMgr()->getBundle(locale, true);
264
265 TextOptionsMenu* menu = (TextOptionsMenu*) HUDDialogStack::get()->top();
266 if (menu) {
267 menu->resize(menu->getWidth(), menu->getHeight());
268 }
269 break;
270 }
271 case 'o': {
272 BZDB.setInt("fontOutline", list->getIndex());
273 break;
274 }
275 case 'S': {
276 if (list->getIndex() > 0) {
277 BZDB.setInt("scoreFontSize", list->getIndex() * fontStep);
278 }
279 else {
280 BZDB.set("scoreFontSize", BZDB.getDefault("scoreFontSize"));
281 }
282 getMainWindow()->getWindow()->callResizeCallbacks();
283 break;
284 }
285 case 'C': {
286 if (list->getIndex() > 0) {
287 BZDB.setInt("consoleFontSize", list->getIndex() * fontStep);
288 }
289 else {
290 BZDB.set("consoleFontSize", BZDB.getDefault("consoleFontSize"));
291 }
292 getMainWindow()->getWindow()->callResizeCallbacks();
293 break;
294 }
295 case 'c': {
296 BZDB.set("colorful", list->getIndex() ? "1" : "0");
297 break;
298 }
299 case 'u': {
300 std::vector<std::string>* options = &list->getList();
301 std::string color = (*options)[list->getIndex()];
302 BZDB.set("underlineColor", color);
303 break;
304 }
305 case 'k': {
306 BZDB.set("killerhighlight", TextUtils::format("%d", list->getIndex()));
307 break;
308 }
309 case 'r': {
310 BZDB.set("pulseRate",

Callers

nothing calls this directly

Calls 14

getBundleMethod · 0.80
topMethod · 0.80
setIntMethod · 0.80
callResizeCallbacksMethod · 0.80
getWindowMethod · 0.80
getMainWindowFunction · 0.70
formatFunction · 0.50
getListMethod · 0.45
getIndexMethod · 0.45
setMethod · 0.45
resizeMethod · 0.45
getWidthMethod · 0.45

Tested by

no test coverage detected