| [4777] | 1 | /* |
|---|
| [2581] | 2 | orxonox - the future of 3D-vertical-scrollers |
|---|
| 3 | |
|---|
| 4 | Copyright (C) 2004 orx |
|---|
| 5 | |
|---|
| 6 | This program is free software; you can redistribute it and/or modify |
|---|
| 7 | it under the terms of the GNU General Public License as published by |
|---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
|---|
| 9 | any later version. |
|---|
| 10 | |
|---|
| 11 | This program is distributed in the hope that it will be useful, |
|---|
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | GNU General Public License for more details. |
|---|
| 15 | |
|---|
| 16 | You should have received a copy of the GNU General Public License |
|---|
| 17 | along with this program; if not, write to the Free Software Foundation, |
|---|
| [4777] | 18 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| [2581] | 19 | |
|---|
| 20 | |
|---|
| 21 | ### File Specific: |
|---|
| 22 | main-programmer: Benjamin Grauer |
|---|
| 23 | |
|---|
| 24 | */ |
|---|
| 25 | |
|---|
| 26 | |
|---|
| [4047] | 27 | #include "gui_video.h" |
|---|
| [7484] | 28 | |
|---|
| [7534] | 29 | #include <QtGui/QLayout> |
|---|
| [10618] | 30 | #include "orxonox_globals.h" |
|---|
| [7481] | 31 | #include "debug.h" |
|---|
| [3624] | 32 | |
|---|
| [8362] | 33 | #include "sdlincl.h" |
|---|
| 34 | |
|---|
| [7547] | 35 | #include "qt_gui_elements.h" |
|---|
| [7484] | 36 | |
|---|
| [7481] | 37 | namespace OrxGui |
|---|
| [2018] | 38 | { |
|---|
| [7481] | 39 | /** |
|---|
| 40 | * Creates the Video-Option-Frame |
|---|
| 41 | */ |
|---|
| [7549] | 42 | GuiVideo::GuiVideo(OrxGui::Gui* gui) |
|---|
| [7598] | 43 | : Element(CONFIG_SECTION_VIDEO, gui), QGroupBox() |
|---|
| [4064] | 44 | { |
|---|
| [7484] | 45 | QGridLayout* layout = new QGridLayout(this); |
|---|
| [7493] | 46 | |
|---|
| [7484] | 47 | { |
|---|
| [7632] | 48 | QtGuiCheckBox* fullscreen = new QtGuiCheckBox(CONFIG_NAME_FULLSCREEN, this, false); |
|---|
| [7484] | 49 | //fullscreen->setName(); |
|---|
| [7493] | 50 | layout->addWidget(fullscreen, 0, 0); |
|---|
| [7484] | 51 | |
|---|
| [9406] | 52 | QtGuiCheckBox* dedicated = new QtGuiCheckBox(CONFIG_NAME_NO_RENDER, this, false); |
|---|
| 53 | //fullscreen->setName(); |
|---|
| 54 | layout->addWidget(dedicated, 1, 0); |
|---|
| 55 | |
|---|
| [7632] | 56 | QtGuiCheckBox* wireframe = new QtGuiCheckBox(CONFIG_NAME_WIREFRAME, this, false); |
|---|
| [9406] | 57 | layout->addWidget(wireframe, 2, 0); |
|---|
| [7493] | 58 | |
|---|
| [7529] | 59 | { |
|---|
| [7632] | 60 | QComboBox* resolution = new QtGuiComboBox(CONFIG_NAME_RESOLUTION, this, "640x480"); |
|---|
| [7639] | 61 | resolution->setEditable(true); |
|---|
| [9406] | 62 | layout->addWidget(resolution, 3, 0); |
|---|
| [7531] | 63 | std::vector<QString> resolutions; |
|---|
| [7529] | 64 | this->getResolutions(resolutions); |
|---|
| 65 | for (unsigned int i = 0; i < resolutions.size(); ++i) |
|---|
| [7534] | 66 | resolution->addItem(resolutions[i]); |
|---|
| [7529] | 67 | } |
|---|
| [7493] | 68 | |
|---|
| [7484] | 69 | |
|---|
| [7598] | 70 | QGroupBox* advanced = new GuiAdvancedVideo(gui); |
|---|
| [4064] | 71 | |
|---|
| [7598] | 72 | |
|---|
| [7547] | 73 | layout->addWidget(advanced, 0, 2, 4, 1); |
|---|
| [7481] | 74 | |
|---|
| [4064] | 75 | } |
|---|
| 76 | } |
|---|
| [2018] | 77 | |
|---|
| [7481] | 78 | /** |
|---|
| 79 | * Destructs the Video-stuff |
|---|
| 80 | */ |
|---|
| 81 | GuiVideo::~GuiVideo() |
|---|
| 82 | { |
|---|
| 83 | // nothing to do here. |
|---|
| 84 | } |
|---|
| [3423] | 85 | |
|---|
| [7481] | 86 | /** |
|---|
| 87 | * sets all resolutions to the menu |
|---|
| 88 | * @param menu the Menu to set The resolutions to. |
|---|
| 89 | */ |
|---|
| [7531] | 90 | void GuiVideo::getResolutions(std::vector<QString>& resolutionList) |
|---|
| [4064] | 91 | { |
|---|
| [7481] | 92 | SDL_Init(SDL_INIT_VIDEO); |
|---|
| 93 | SDL_Rect **modes; |
|---|
| 94 | int i; |
|---|
| 95 | int x = 0,y =0; // check for difference |
|---|
| 96 | char tmpChar[100]; |
|---|
| [3423] | 97 | |
|---|
| [7481] | 98 | /* Get available fullscreen/hardware modes */ |
|---|
| 99 | modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE); |
|---|
| 100 | |
|---|
| 101 | /* Check is there are any modes available */ |
|---|
| 102 | if(modes == (SDL_Rect **)0) |
|---|
| [4064] | 103 | { |
|---|
| [7481] | 104 | PRINTF(2)("No video-modes available!\n"); |
|---|
| 105 | exit(-1); |
|---|
| 106 | } |
|---|
| [3423] | 107 | |
|---|
| [7481] | 108 | /* Check if our resolution is restricted */ |
|---|
| 109 | if(modes == (SDL_Rect **)-1) |
|---|
| 110 | { |
|---|
| 111 | PRINTF(2)("All resolutions available.\n"); |
|---|
| [4064] | 112 | } |
|---|
| [7481] | 113 | else |
|---|
| 114 | { |
|---|
| 115 | /* Print valid modes */ |
|---|
| 116 | PRINT(5)("Available Modes\n"); |
|---|
| 117 | for(i = 0; modes[i] ;++i) |
|---|
| [3624] | 118 | { |
|---|
| [4777] | 119 | if (x != modes[i]->w || y != modes[i]->h) |
|---|
| [7481] | 120 | { |
|---|
| 121 | PRINTF(5)(" %d x %d\n", modes[i]->w, modes[i]->h); |
|---|
| 122 | sprintf(tmpChar, "%dx%d", modes[i]->w, modes[i]->h); |
|---|
| [7534] | 123 | resolutionList.push_back(QString(tmpChar)); |
|---|
| [7481] | 124 | x = modes[i]->w; y = modes[i]->h; |
|---|
| 125 | } |
|---|
| [3624] | 126 | } |
|---|
| [7481] | 127 | } |
|---|
| 128 | SDL_QuitSubSystem(SDL_INIT_VIDEO); |
|---|
| 129 | SDL_Quit(); |
|---|
| [3624] | 130 | } |
|---|
| [7481] | 131 | |
|---|
| [7598] | 132 | |
|---|
| 133 | |
|---|
| 134 | GuiAdvancedVideo::GuiAdvancedVideo(OrxGui::Gui* gui) |
|---|
| 135 | : Element(CONFIG_SECTION_VIDEO_ADVANCED ,gui) |
|---|
| 136 | { |
|---|
| 137 | { |
|---|
| 138 | QGridLayout* advLayout = new QGridLayout(this); //!< Advanced Layout |
|---|
| 139 | { |
|---|
| [7633] | 140 | QtGuiCheckBox* shadows = new QtGuiCheckBox(CONFIG_NAME_SHADOWS, this, true); //!< CheckBox for shadows |
|---|
| [7598] | 141 | advLayout->addWidget(shadows, 0,0); |
|---|
| [7633] | 142 | QtGuiCheckBox* fog = new QtGuiCheckBox(CONFIG_NAME_FOG, this, true); //!< CheckBox for fog. |
|---|
| [7598] | 143 | advLayout->addWidget(fog, 1,0); |
|---|
| [7633] | 144 | QtGuiCheckBox* reflections = new QtGuiCheckBox(CONFIG_NAME_REFLECTIONS, this, true); //!< CheckBox for reflections |
|---|
| [7598] | 145 | advLayout->addWidget(reflections, 2, 0); |
|---|
| [7633] | 146 | QtGuiCheckBox* textures = new QtGuiCheckBox(CONFIG_NAME_TEXTURES, this, true); //!< CheckBox for textures |
|---|
| [7598] | 147 | advLayout->addWidget(textures, 3, 0); |
|---|
| 148 | /* |
|---|
| 149 | Menu* textureDetail; //!< Menu for the Texture-Detail. |
|---|
| 150 | Label* modelDetailLabel; //!< Label for model-detail. |
|---|
| 151 | Menu* modelDetail; //!< model-detail. |
|---|
| 152 | CheckBox* particles; //!< If the Particles should be enabled |
|---|
| 153 | Label* antiAliasingLabel; //!< Label for the anti-aliasing mode. |
|---|
| 154 | Menu* antiAliasing; //!< Menu for the Antialiasing-mode. |
|---|
| 155 | Label* filterMethodLabel; //!< Label for filtering-Method. |
|---|
| 156 | Menu* filterMethod; //!< Menu for filtering Method. |
|---|
| 157 | Button* closeButton; //!< A Button to close the Advanced-settingsWindow. |
|---|
| 158 | */ |
|---|
| 159 | } |
|---|
| 160 | } |
|---|
| 161 | } |
|---|
| 162 | |
|---|
| 163 | GuiAdvancedVideo::~GuiAdvancedVideo() |
|---|
| 164 | { |
|---|
| 165 | } |
|---|
| 166 | |
|---|
| [3624] | 167 | } |
|---|