1 /* 2 * This file is part of Dune Legacy. 3 * 4 * Dune Legacy is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * Dune Legacy is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with Dune Legacy. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef GAMEOPTIONSWINDOW_H 19 #define GAMEOPTIONSWINDOW_H 20 21 #include <GUI/Window.h> 22 #include <GUI/HBox.h> 23 #include <GUI/VBox.h> 24 #include <GUI/TextButton.h> 25 #include <GUI/Label.h> 26 #include <GUI/Spacer.h> 27 #include <GUI/Checkbox.h> 28 #include <GUI/PictureButton.h> 29 #include <GUI/ProgressBar.h> 30 #include <GUI/dune/DigitsTextBox.h> 31 32 #include <DataTypes.h> 33 34 #include <algorithm> 35 36 class GameOptionsWindow : public Window 37 { 38 public: 39 explicit GameOptionsWindow(SettingsClass::GameOptionsClass& initialGameOptions); 40 virtual ~GameOptionsWindow(); 41 42 void onOK(); 43 getGameOptions()44 const SettingsClass::GameOptionsClass& getGameOptions() const { return gameOptions; }; 45 46 /** 47 This static method creates a dynamic game options window. 48 The idea behind this method is to simply create a new dialog on the fly and 49 add it as a child window of some other window. If the window gets closed it will be freed. 50 \param initialGameOptions the game options that will be shown on start of the dialog 51 \return The new dialog box (will be automatically destroyed when it's closed) 52 */ create(SettingsClass::GameOptionsClass & initialGameOptions)53 static GameOptionsWindow* create(SettingsClass::GameOptionsClass& initialGameOptions) { 54 GameOptionsWindow* dlg = new GameOptionsWindow(initialGameOptions); 55 dlg->pAllocated = true; 56 return dlg; 57 } 58 59 private: 60 void onGameSpeedMinus(); 61 void onGameSpeedPlus(); 62 void updateGameSpeedBar(); 63 64 int currentGameSpeed; 65 SettingsClass::GameOptionsClass gameOptions; 66 67 VBox vbox; ///< vertical box 68 HBox hbox; ///< horizontal box 69 VBox vboxLeft; ///< inner vertical box on the left side 70 VBox vboxRight; ///< inner vertical box on the right side 71 Label captionlabel; ///< label that contains the caption 72 Checkbox concreteRequiredCheckbox; ///< If not checked we can build without penalties on the bare rock 73 Checkbox structuresDegradeOnConcreteCheckbox; ///< If checked, structures will degrade on power shortage even when build on concrete 74 Checkbox fogOfWarCheckbox; ///< If checked explored terrain will become foggy when no unit or structure is next to it 75 Checkbox startWithExploredMapCheckbox; ///< If checked the complete map is unhidden at the beginning of the game 76 Checkbox instantBuildCheckbox; ///< If checked the building of structures and units does not take any time 77 Checkbox onlyOnePalaceCheckbox; ///< If checked only one palace can be build per house 78 Checkbox rocketTurretsNeedPowerCheckbox; ///< If checked rocket turrets are dysfunctional on power shortage 79 Checkbox sandwormsRespawnCheckbox; ///< If checked killed sandworms respawn after some time 80 Checkbox killedSandwormsDropSpiceCheckbox; ///< If checked killed sandworms drop some spice 81 Checkbox manualCarryallDropsCheckbox; ///< If checked player can request carryall to transport units 82 HBox gameSpeedHBox; ///< The HBox containing the game speed selection 83 PictureButton gameSpeedPlus; ///< The button for increasing the game speed 84 PictureButton gameSpeedMinus; ///< The button for decreasing the game speed 85 TextProgressBar gameSpeedBar; ///< The bar showing the current game speed 86 HBox maxUnitsOverrideHBox; ///< The HBox containing the override option for the maximum number of units 87 Checkbox maxUnitsOverrideCheckbox; ///< If checked the maximum number of units is set directly, otherwise it is determined by the map 88 DigitsTextBox maxUnitsOverrideTextBox; ///< The maximum number of units 89 TextButton okbutton; ///< the ok button 90 }; 91 92 93 #endif // GAMEOPTIONSWINDOW_H 94