]> git.mxchange.org Git - flightgear.git/blob - Main/options.hxx
Added i/I to toggle full vs. minimal HUD.
[flightgear.git] / Main / options.hxx
1 //
2 // options.hxx -- class to handle command line options
3 //
4 // Written by Curtis Olson, started April 1998.
5 //
6 // Copyright (C) 1998  Curtis L. Olson  - curt@me.umn.edu
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 //
22 // $Id$
23 // (Log is kept at end of this file)
24
25
26 #ifndef _OPTIONS_HXX
27 #define _OPTIONS_HXX
28
29
30 #ifndef __cplusplus                                                          
31 # error This library requires C++
32 #endif                                   
33
34
35 #define FG_OPTIONS_OK 0
36 #define FG_OPTIONS_HELP 1
37 #define FG_OPTIONS_ERROR 2
38
39
40 class fgOPTIONS {
41
42     // The flight gear "root" directory
43     char fg_root[256];
44
45     // Starting position and orientation
46
47     // ID of initial starting airport, only need 5 bytes but I guess
48     // 16 is good for memory alignment.
49     char airport_id[16];
50     double lon;         // starting longitude in degrees (west = -)
51     double lat;         // starting latitude in degrees (south = -)
52     double altitude;    // starting altitude in meters
53     double heading;     // heading (yaw) angle in degress (Psi)
54     double roll;        // roll angle in degrees (Phi)
55     double pitch;       // pitch angle in degrees (Theta)
56
57     // Miscellaneous
58     int game_mode;      // Game mode enabled/disabled
59     int splash_screen; // show splash screen
60     int intro_music;   // play introductory music
61     int mouse_pointer; // show mouse pointer
62     int pause;         // pause intially enabled/disabled
63
64     // Features
65     int hud_status;    // HUD on/off
66     int panel_status;  // Panel on/off
67     int sound;         // play sound effects
68
69     // Flight Model options
70     int flight_model;  // Flight Model:  FG_SLEW, FG_LARCSIM, etc.
71
72     // Rendering options
73     int fog;           // Fog enabled/disabled
74     double fov;        // Field of View
75     int fullscreen;    // Full screen mode enabled/disabled
76     int shading;       // shading method, 0 = Flat, 1 = Smooth
77     int skyblend;      // Blend sky to haze (using polygons) or just clear
78     int textures;      // Textures enabled/disabled
79     int wireframe;     // Wireframe mode enabled/disabled
80
81     // Scenery options
82     int tile_radius;   // Square radius of rendered tiles (around center 
83                        // square.)
84     int tile_diameter; // Diameter of rendered tiles.  for instance
85                        // if tile_diameter = 3 then a 3 x 3 grid of tiles will 
86                        // be drawn.  Increase this to see terrain that is 
87                        // further away.
88
89     // HUD options
90     int tris_or_culled;
91
92     // Time options
93     int time_offset;   // Offset true time by this many seconds
94
95 public:
96
97     // Constructor
98     fgOPTIONS( void );
99
100     // Parse a single option
101     int parse_option( char *arg );
102
103     // Parse the command line options
104     int parse_command_line( int argc, char **argv );
105
106     // Parse the command line options
107     int parse_config_file( char *path );
108
109     // Print usage message
110     void usage ( void );
111
112     // Query functions
113     void get_fg_root(char *root) { strcpy(root, fg_root); }
114     void get_airport_id(char *id) { strcpy(id, airport_id); }
115     double get_lon( void ) { return(lon); }
116     double get_lat( void ) { return(lat); }
117     double get_altitude( void ) { return(altitude); }
118     double get_heading( void ) { return(heading); }
119     double get_roll( void ) { return(roll); }
120     double get_pitch( void ) { return(pitch); }
121     int get_game_mode( void ) { return(game_mode); }
122     int get_splash_screen( void ) { return(splash_screen); }
123     int get_intro_music( void ) { return(intro_music); }
124     int get_mouse_pointer( void ) { return(mouse_pointer); }
125     int get_pause( void ) { return(pause); }
126     int get_hud_status( void ) { return(hud_status); }
127     int get_panel_status( void ) { return(panel_status); }
128     int get_sound( void ) { return(sound); }
129     int get_flight_model( void ) { return(flight_model); }
130     int get_fog( void ) { return(fog); }
131     double get_fov( void ) { return(fov); }
132     int get_fullscreen( void ) { return(fullscreen); }
133     int get_shading( void ) { return(shading); }
134     int get_skyblend( void ) { return(skyblend); }
135     int get_textures( void ) { return(textures); }
136     int get_wireframe( void ) { return(wireframe); }
137     int get_tile_radius( void ) { return(tile_radius); }
138     int get_tile_diameter( void ) { return(tile_diameter); }
139     int get_time_offset( void ) { return(time_offset); }
140     int get_tris_or_culled( void )   { return(tris_or_culled); }
141
142     // Update functions
143     void set_hud_status( int status ) { hud_status = status; }
144     void set_fov( double amount ) { fov = amount; }
145
146 #if 0
147     void get_fg_root(char *root);
148     void get_airport_id(char *id);
149     double get_lon( void );
150     double get_lat( void );
151     double get_altitude( void );
152     double get_heading( void );
153     double get_roll( void );
154     double get_pitch( void );
155     int get_game_mode( void );
156     int get_splash_screen( void );
157     int get_intro_music( void );
158     int get_mouse_pointer( void );
159     int get_pause( void );
160     int get_hud_status( void );
161     int get_panel_status( void );
162     int get_sound( void );
163     int get_flight_model( void );
164     int get_fog( void );
165     double get_fov( void );
166     int get_fullscreen( void );
167     int get_shading( void );
168     int get_skyblend( void );
169     int get_textures( void );
170     int get_wireframe( void );
171     int get_tile_radius( void );
172     int get_tile_diameter( void );
173     int get_time_offset( void );
174     int get_tris_or_culled( void )   { return(tris_or_culled); }
175
176     // Update functions
177     void set_hud_status( int status );
178     void set_fov( double amount );
179 #endif
180
181     // Destructor
182     ~fgOPTIONS( void );
183
184 };
185
186
187 extern fgOPTIONS current_options;
188
189
190 #endif /* _OPTIONS_HXX */
191
192
193 // $Log$
194 // Revision 1.15  1998/08/24 20:11:15  curt
195 // Added i/I to toggle full vs. minimal HUD.
196 // Added a --hud-tris vs --hud-culled option.
197 // Moved options accessor funtions to options.hxx.
198 //
199 // Revision 1.14  1998/08/20 15:10:35  curt
200 // Added GameGLUT support.
201 //
202 // Revision 1.13  1998/07/30 23:48:29  curt
203 // Output position & orientation when pausing.
204 // Eliminated libtool use.
205 // Added options to specify initial position and orientation.
206 // Changed default fov to 55 degrees.
207 // Added command line option to start in paused or unpaused state.
208 //
209 // Revision 1.12  1998/07/27 18:41:26  curt
210 // Added a pause command "p"
211 // Fixed some initialization order problems between pui and glut.
212 // Added an --enable/disable-sound option.
213 //
214 // Revision 1.11  1998/07/13 21:01:39  curt
215 // Wrote access functions for current fgOPTIONS.
216 //
217 // Revision 1.10  1998/07/06 21:34:20  curt
218 // Added an enable/disable splash screen option.
219 // Added an enable/disable intro music option.
220 // Added an enable/disable instrument panel option.
221 // Added an enable/disable mouse pointer option.
222 // Added using namespace std for compilers that support this.
223 //
224 // Revision 1.9  1998/06/27 16:54:34  curt
225 // Replaced "extern displayInstruments" with a entry in fgOPTIONS.
226 // Don't change the view port when displaying the panel.
227 //
228 // Revision 1.8  1998/05/16 13:08:36  curt
229 // C++ - ified views.[ch]xx
230 // Shuffled some additional view parameters into the fgVIEW class.
231 // Changed tile-radius to tile-diameter because it is a much better
232 //   name.
233 // Added a WORLD_TO_EYE transformation to views.cxx.  This allows us
234 //  to transform world space to eye space for view frustum culling.
235 //
236 // Revision 1.7  1998/05/13 18:29:59  curt
237 // Added a keyboard binding to dynamically adjust field of view.
238 // Added a command line option to specify fov.
239 // Adjusted terrain color.
240 // Root path info moved to fgOPTIONS.
241 // Added ability to parse options out of a config file.
242 //
243 // Revision 1.6  1998/05/06 03:16:26  curt
244 // Added an averaged global frame rate counter.
245 // Added an option to control tile radius.
246 //
247 // Revision 1.5  1998/05/03 00:47:32  curt
248 // Added an option to enable/disable full-screen mode.
249 //
250 // Revision 1.4  1998/04/30 12:34:19  curt
251 // Added command line rendering options:
252 //   enable/disable fog/haze
253 //   specify smooth/flat shading
254 //   disable sky blending and just use a solid color
255 //   enable wireframe drawing mode
256 //
257 // Revision 1.3  1998/04/28 01:20:23  curt
258 // Type-ified fgTIME and fgVIEW.
259 // Added a command line option to disable textures.
260 //
261 // Revision 1.2  1998/04/25 15:11:13  curt
262 // Added an command line option to set starting position based on airport ID.
263 //
264 // Revision 1.1  1998/04/24 00:49:21  curt
265 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
266 // Trying out some different option parsing code.
267 // Some code reorganization.
268 //
269 //