1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of OGRE
|
---|
4 | (Object-oriented Graphics Rendering Engine)
|
---|
5 | For the latest info, see http://www.ogre3d.org/
|
---|
6 |
|
---|
7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under
|
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
13 | version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
23 | -----------------------------------------------------------------------------
|
---|
24 | */
|
---|
25 |
|
---|
26 |
|
---|
27 | #include "OgreSDLConfig.h"
|
---|
28 | #include "OgreException.h"
|
---|
29 |
|
---|
30 | using namespace Ogre;
|
---|
31 |
|
---|
32 | bool SDLConfig::display(void)
|
---|
33 | {
|
---|
34 | std::cout << "OGRE Configuration" << std::endl << "------------------" << std::endl;
|
---|
35 |
|
---|
36 | // Get the renderer
|
---|
37 | std::cout << "Select Renderer:" << std::endl;
|
---|
38 | int x = 1, choice = 0;
|
---|
39 | RenderSystemList* renderers = Root::getSingleton().getAvailableRenderers();
|
---|
40 | for (RenderSystemList::iterator pRend = renderers->begin();
|
---|
41 | pRend != renderers->end(); pRend++)
|
---|
42 | {
|
---|
43 | std::cout << " " << x << ") " << (*pRend)->getName() << std::endl;;
|
---|
44 | x++;
|
---|
45 | }
|
---|
46 |
|
---|
47 | std::cin >> choice;
|
---|
48 |
|
---|
49 | if (choice<=0 || choice>=x) {
|
---|
50 | OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
|
---|
51 | "Invalid RenderSystem number",
|
---|
52 | "SDLConfig::display");
|
---|
53 | }
|
---|
54 | RenderSystem* renderer = (*renderers)[choice-1];
|
---|
55 |
|
---|
56 | ConfigOptionMap options = renderer->getConfigOptions();
|
---|
57 |
|
---|
58 | // Process each option
|
---|
59 | for (ConfigOptionMap::iterator it = options.begin();
|
---|
60 | it != options.end(); it++)
|
---|
61 | {
|
---|
62 | std::cout << it->second.name << ": " << std::endl;
|
---|
63 | x = 1;
|
---|
64 | StringVector::iterator opt_it;
|
---|
65 | for (opt_it = it->second.possibleValues.begin();
|
---|
66 | opt_it != it->second.possibleValues.end(); opt_it++)
|
---|
67 | {
|
---|
68 | if ((*opt_it) == it->second.currentValue)
|
---|
69 | std::cout << "--> ";
|
---|
70 | else
|
---|
71 | std::cout << " ";
|
---|
72 | std::cout << x << ") " << (*opt_it) << std::endl;
|
---|
73 | x++;
|
---|
74 | }
|
---|
75 |
|
---|
76 | choice = 0;
|
---|
77 | std::cin >> choice;
|
---|
78 | if (choice<=0 || choice>=x) {
|
---|
79 | OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
|
---|
80 | "Invalid number chosen for '"+it->second.name+"' option",
|
---|
81 | "SDLConfig::display");
|
---|
82 | }
|
---|
83 | opt_it = it->second.possibleValues.begin();
|
---|
84 | renderer->setConfigOption(it->second.name, opt_it[choice-1]);
|
---|
85 | }
|
---|
86 |
|
---|
87 | // All done
|
---|
88 | Root::getSingleton().setRenderSystem(renderer);
|
---|
89 | Root::getSingleton().saveConfig();
|
---|
90 |
|
---|
91 | return true;
|
---|
92 | }
|
---|