| 293 | } |
| 294 | |
| 295 | void InputMenu::resize(int _width, int _height) { |
| 296 | HUDDialog::resize(_width, _height); |
| 297 | FontSizer fs = FontSizer(_width, _height); |
| 298 | |
| 299 | int i; |
| 300 | |
| 301 | FontManager& fm = FontManager::instance(); |
| 302 | const LocalFontFace* fontFace = MainMenu::getFontFace(); |
| 303 | |
| 304 | // use a big font for title, smaller font for the rest |
| 305 | fs.setMin(0, (int)(1.0 / BZDB.eval("headerFontSize") / 2.0)); |
| 306 | const float titleFontSize = fs.getFontSize(fontFace->getFMFace(), "headerFontSize"); |
| 307 | |
| 308 | fs.setMin(0, 20); |
| 309 | const float fontSize = fs.getFontSize(fontFace->getFMFace(), "menuFontSize"); |
| 310 | |
| 311 | // reposition title |
| 312 | std::vector<HUDuiElement*>& listHUD = getElements(); |
| 313 | HUDuiLabel* title = (HUDuiLabel*)listHUD[0]; |
| 314 | title->setFontSize(titleFontSize); |
| 315 | const float titleWidth = fm.getStringWidth(fontFace->getFMFace(), titleFontSize, title->getString()); |
| 316 | const float titleHeight = fm.getStringHeight(fontFace->getFMFace(), titleFontSize); |
| 317 | float x = 0.5f * ((float)_width - titleWidth); |
| 318 | float y = (float)_height - titleHeight; |
| 319 | title->setPosition(x, y); |
| 320 | |
| 321 | // reposition options |
| 322 | x = 0.5f * ((float)_width + 0.5f * titleWidth); |
| 323 | y -= 1.0f * titleHeight; |
| 324 | const float h = fm.getStringHeight(fontFace->getFMFace(), fontSize); |
| 325 | const int count = (int)listHUD.size(); |
| 326 | for (i = 1; i < count; i++) { |
| 327 | listHUD[i]->setFontSize(fontSize); |
| 328 | listHUD[i]->setPosition(x, y); |
| 329 | y -= 1.0f * h; |
| 330 | } |
| 331 | |
| 332 | // load current settings |
| 333 | std::vector<std::string> *options = &activeInput->getList(); |
| 334 | for (i = 0; i < (int)options->size(); i++) { |
| 335 | std::string currentOption = (*options)[i]; |
| 336 | if (BZDB.get("activeInputDevice") == currentOption) { |
| 337 | activeInput->setIndex(i); |
| 338 | } |
| 339 | } |
| 340 | if (BZDB.isTrue("allowInputChange")) { |
| 341 | activeInput->setIndex(0); |
| 342 | } |
| 343 | |
| 344 | for (i = 1; i < count; i++) { |
| 345 | if (listHUD[i]->getLabel() == "Confine mouse:") { |
| 346 | HUDuiList* list = reinterpret_cast<HUDuiList*>(listHUD[i]); |
| 347 | if (BZDB.isTrue("mousegrab")) { |
| 348 | list->setIndex(1); |
| 349 | } |
| 350 | else if (BZDB.isTrue("mouseClamp")) { |
| 351 | list->setIndex(2); |
| 352 | } |
nothing calls this directly
no test coverage detected