* Initializes all the elements in the Video Options screen. * @param game Pointer to the core game. * @param origin Game section that originated this state. */
| 47 | * @param origin Game section that originated this state. |
| 48 | */ |
| 49 | OptionsVideoState::OptionsVideoState(Game *game, OptionsOrigin origin) : OptionsBaseState(game, origin) |
| 50 | { |
| 51 | setCategory(_btnVideo); |
| 52 | |
| 53 | // Create objects |
| 54 | _displaySurface = new InteractiveSurface(110, 32, 94, 18); |
| 55 | _txtDisplayResolution = new Text(114, 9, 94, 8); |
| 56 | _txtDisplayWidth = new TextEdit(this, 40, 17, 94, 26); |
| 57 | _txtDisplayX = new Text(16, 17, 132, 26); |
| 58 | _txtDisplayHeight = new TextEdit(this, 40, 17, 144, 26); |
| 59 | _btnDisplayResolutionUp = new ArrowButton(ARROW_BIG_UP, 14, 14, 186, 18); |
| 60 | _btnDisplayResolutionDown = new ArrowButton(ARROW_BIG_DOWN, 14, 14, 186, 36); |
| 61 | |
| 62 | _txtLanguage = new Text(114, 9, 94, 52); |
| 63 | _cbxLanguage = new ComboBox(this, 104, 16, 94, 62); |
| 64 | |
| 65 | _txtFilter = new Text(114, 9, 206, 52); |
| 66 | _cbxFilter = new ComboBox(this, 104, 16, 206, 62); |
| 67 | |
| 68 | _txtMode = new Text(114, 9, 206, 22); |
| 69 | _cbxDisplayMode = new ComboBox(this, 104, 16, 206, 32); |
| 70 | |
| 71 | _txtGeoScale = new Text(114, 9, 94, 82); |
| 72 | _cbxGeoScale = new ComboBox(this, 104, 16, 94, 92); |
| 73 | |
| 74 | _txtBattleScale = new Text(114, 9, 94, 112); |
| 75 | _cbxBattleScale = new ComboBox(this, 104, 16, 94, 122); |
| 76 | |
| 77 | _txtOptions = new Text(114, 9, 206, 82); |
| 78 | _btnLetterbox = new ToggleTextButton(104, 16, 206, 92); |
| 79 | _btnLockMouse = new ToggleTextButton(104, 16, 206, 110); |
| 80 | |
| 81 | // Get available fullscreen modes |
| 82 | _res = SDL_ListModes(NULL, SDL_FULLSCREEN); |
| 83 | if (_res != (SDL_Rect**)-1 && _res != (SDL_Rect**)0) |
| 84 | { |
| 85 | int i; |
| 86 | _resCurrent = -1; |
| 87 | for (i = 0; _res[i]; ++i) |
| 88 | { |
| 89 | if (_resCurrent == -1 && |
| 90 | ((_res[i]->w == Options::displayWidth && _res[i]->h <= Options::displayHeight) || _res[i]->w < Options::displayWidth)) |
| 91 | { |
| 92 | _resCurrent = i; |
| 93 | } |
| 94 | } |
| 95 | _resAmount = i; |
| 96 | } |
| 97 | else |
| 98 | { |
| 99 | _resCurrent = -1; |
| 100 | _resAmount = 0; |
| 101 | _btnDisplayResolutionDown->setVisible(false); |
| 102 | _btnDisplayResolutionUp->setVisible(false); |
| 103 | Log(LOG_WARNING) << "Couldn't get display resolutions"; |
| 104 | } |
| 105 | |
| 106 | add(_displaySurface); |
nothing calls this directly
no test coverage detected