1 | /* |
---|
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, |
---|
18 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
19 | |
---|
20 | |
---|
21 | ### File Specific: |
---|
22 | main-programmer: Benjamin Grauer |
---|
23 | |
---|
24 | */ |
---|
25 | |
---|
26 | #include "orxonox_gui.h" |
---|
27 | #include "orxonox_gui_video.h" |
---|
28 | #include "orxonox_gui_audio.h" |
---|
29 | #include "orxonox_gui_exec.h" |
---|
30 | #include "orxonox_gui_flags.h" |
---|
31 | #include "orxonox_gui_banner.h" |
---|
32 | #include "orxonox_gui_keys.h" |
---|
33 | |
---|
34 | Window* orxonoxGUI; |
---|
35 | OrxonoxGuiVideo* video; |
---|
36 | OrxonoxGuiAudio* audio; |
---|
37 | OrxonoxGuiExec* exec; |
---|
38 | OrxonoxGuiFlags* flags; |
---|
39 | OrxonoxGuiBanner* banner; |
---|
40 | OrxonoxGuiKeys* keys; |
---|
41 | |
---|
42 | int main( int argc, char *argv[] ) |
---|
43 | { |
---|
44 | OrxonoxGui* orxonoxgui = new OrxonoxGui(argc, argv); |
---|
45 | return 0; |
---|
46 | } |
---|
47 | |
---|
48 | /* ORXONOXGUI */ |
---|
49 | |
---|
50 | /** |
---|
51 | \brief Initializes the Gui |
---|
52 | */ |
---|
53 | OrxonoxGui::OrxonoxGui (int argc, char *argv[]) |
---|
54 | { |
---|
55 | #ifdef HAVE_GTK2 |
---|
56 | initGTK(argc, argv); |
---|
57 | #endif /* HAVE_GTK2 */ |
---|
58 | orxonoxGUI = new Window( "Grafical OrxOnoX loader, "PACKAGE_VERSION); |
---|
59 | #ifdef HAVE_GTK2 |
---|
60 | orxonoxGUI->connectSignal ("destroy", orxonoxGUI->orxonox_gui_quit); |
---|
61 | orxonoxGUI->connectSignal ("delete_event", orxonoxGUI->orxonox_gui_quit); |
---|
62 | #endif /* HAVE_GTK2 */ |
---|
63 | |
---|
64 | Box* windowBox = new Box ('h'); |
---|
65 | |
---|
66 | banner = new OrxonoxGuiBanner(); |
---|
67 | windowBox->fill (banner->getWidget()); |
---|
68 | |
---|
69 | Box* optionBox = new Box ('v'); |
---|
70 | |
---|
71 | Box* avBox = new Box ('h'); |
---|
72 | |
---|
73 | video = new OrxonoxGuiVideo (); |
---|
74 | avBox->fill (video->getWidget ()); |
---|
75 | audio = new OrxonoxGuiAudio (); |
---|
76 | avBox->fill (audio->getWidget ()); |
---|
77 | |
---|
78 | optionBox->fill (avBox); |
---|
79 | |
---|
80 | keys = new OrxonoxGuiKeys (); |
---|
81 | optionBox->fill (keys->getWidget ()); |
---|
82 | |
---|
83 | exec = new OrxonoxGuiExec (orxonoxGUI); |
---|
84 | optionBox->fill (exec->getWidget ()); |
---|
85 | |
---|
86 | flags = new OrxonoxGuiFlags (orxonoxGUI); |
---|
87 | |
---|
88 | |
---|
89 | optionBox->fill (flags->getWidget ()); |
---|
90 | windowBox->fill (optionBox); |
---|
91 | |
---|
92 | orxonoxGUI->fill (windowBox); |
---|
93 | flags->setTextFromFlags (orxonoxGUI); |
---|
94 | |
---|
95 | exec->setFilename ("~/.orxonox.conf"); |
---|
96 | exec->readFromFile (orxonoxGUI); |
---|
97 | // orxonoxGUI->walkThrough(orxonoxGUI->listOptions); |
---|
98 | |
---|
99 | orxonoxGUI->showall (); |
---|
100 | |
---|
101 | |
---|
102 | #ifdef HAVE_GTK2 |
---|
103 | mainloopGTK(); |
---|
104 | #else /* HAVE_GTK2 */ |
---|
105 | cout << " Listing all the Orxonox Options: \n"; |
---|
106 | cout << " #############################\n"; |
---|
107 | orxonoxGUI->walkThrough(orxonoxGUI->listOptions); |
---|
108 | |
---|
109 | cout << "\nDo you want me to save the the above values now? [Yn] "; |
---|
110 | char c = getchar(); |
---|
111 | if ((c == 'y' || c == 'Y' || c== 10) && exec->shouldsave()) |
---|
112 | exec->writeToFile (Window::mainWindow); |
---|
113 | |
---|
114 | #endif /* HAVE_GTK2 */ |
---|
115 | |
---|
116 | } |
---|