2 // options.hxx -- class to handle command line options
4 // Written by Curtis Olson, started April 1998.
6 // Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu
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.
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.
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.
23 // (Log is kept at end of this file)
31 # error This library requires C++
40 #ifdef NEEDNAMESPACESTD
60 static const int FG_RADIUS_MIN = 1;
61 static const int FG_RADIUS_MAX = 4;
65 // The flight gear "root" directory
68 // Starting position and orientation
69 string airport_id; // ID of initial starting airport
70 double lon; // starting longitude in degrees (west = -)
71 double lat; // starting latitude in degrees (south = -)
72 double altitude; // starting altitude in meters
73 double heading; // heading (yaw) angle in degress (Psi)
74 double roll; // roll angle in degrees (Phi)
75 double pitch; // pitch angle in degrees (Theta)
78 bool game_mode; // Game mode enabled/disabled
79 bool splash_screen; // show splash screen
80 bool intro_music; // play introductory music
81 int mouse_pointer; // show mouse pointer
82 bool pause; // pause intially enabled/disabled
85 bool hud_status; // HUD on/off
86 bool panel_status; // Panel on/off
87 bool sound; // play sound effects
89 // Flight Model options
90 int flight_model; // Flight Model: FG_SLEW, FG_LARCSIM, etc.
93 fgFogKind fog; // Fog nicest/fastest/disabled
94 double fov; // Field of View
95 bool fullscreen; // Full screen mode enabled/disabled
96 int shading; // shading method, 0 = Flat, 1 = Smooth
97 bool skyblend; // Blend sky to haze (using polygons) or just clear
98 bool textures; // Textures enabled/disabled
99 bool wireframe; // Wireframe mode enabled/disabled
102 int tile_radius; // Square radius of rendered tiles (around center
104 int tile_diameter; // Diameter of rendered tiles. for instance
105 // if tile_diameter = 3 then a 3 x 3 grid of tiles will
106 // be drawn. Increase this to see terrain that is
113 int time_offset; // Offset true time by this many seconds
120 // Parse a single option
121 int parse_option( const string& arg );
123 // Parse the command line options
124 int parse_command_line( int argc, char **argv );
126 // Parse the command line options
127 int parse_config_file( const string& path );
129 // Print usage message
133 string get_fg_root() const { return fg_root; }
134 string get_airport_id() const { return airport_id; }
135 double get_lon() const { return lon; }
136 double get_lat() const { return lat; }
137 double get_altitude() const { return altitude; }
138 double get_heading() const { return heading; }
139 double get_roll() const { return roll; }
140 double get_pitch() const { return pitch; }
141 bool get_game_mode() const { return game_mode; }
142 bool get_splash_screen() const { return splash_screen; }
143 bool get_intro_music() const { return intro_music; }
144 int get_mouse_pointer() const { return mouse_pointer; }
145 bool get_pause() const { return pause; }
146 bool get_hud_status() const { return hud_status; }
147 bool get_panel_status() const { return panel_status; }
148 bool get_sound() const { return sound; }
149 int get_flight_model() const { return flight_model; }
150 bool fog_enabled() const { return fog != FG_FOG_DISABLED; }
151 fgFogKind get_fog() const { return fog; }
152 double get_fov() const { return fov; }
153 bool get_fullscreen() const { return fullscreen; }
154 int get_shading() const { return shading; }
155 bool get_skyblend() const { return skyblend; }
156 bool get_textures() const { return textures; }
157 bool get_wireframe() const { return wireframe; }
158 int get_tile_radius() const { return tile_radius; }
159 int get_tile_diameter() const { return tile_diameter; }
160 int get_time_offset() const { return time_offset; }
161 int get_tris_or_culled() const { return tris_or_culled; }
164 void set_hud_status( bool status ) { hud_status = status; }
165 void set_fov( double amount ) { fov = amount; }
169 double parse_time( const string& time_str );
170 double parse_degree( const string& degree_str );
171 int parse_time_offset( const string& time_str );
172 int parse_tile_radius( const string& arg );
173 int parse_flight_model( const string& fm );
174 double parse_fov( const string& arg );
178 extern fgOPTIONS current_options;
181 #endif /* _OPTIONS_HXX */
185 // Revision 1.17 1998/09/08 21:40:10 curt
186 // Fixes by Charlie Hotchkiss.
188 // Revision 1.16 1998/08/27 17:02:08 curt
189 // Contributions from Bernie Bright <bbright@c031.aone.net.au>
190 // - use strings for fg_root and airport_id and added methods to return
192 // - inlined all access methods,
193 // - made the parsing functions private methods,
194 // - deleted some unused functions.
195 // - propogated some of these changes out a bit further.
197 // Revision 1.15 1998/08/24 20:11:15 curt
198 // Added i/I to toggle full vs. minimal HUD.
199 // Added a --hud-tris vs --hud-culled option.
200 // Moved options accessor funtions to options.hxx.
202 // Revision 1.14 1998/08/20 15:10:35 curt
203 // Added GameGLUT support.
205 // Revision 1.13 1998/07/30 23:48:29 curt
206 // Output position & orientation when pausing.
207 // Eliminated libtool use.
208 // Added options to specify initial position and orientation.
209 // Changed default fov to 55 degrees.
210 // Added command line option to start in paused or unpaused state.
212 // Revision 1.12 1998/07/27 18:41:26 curt
213 // Added a pause command "p"
214 // Fixed some initialization order problems between pui and glut.
215 // Added an --enable/disable-sound option.
217 // Revision 1.11 1998/07/13 21:01:39 curt
218 // Wrote access functions for current fgOPTIONS.
220 // Revision 1.10 1998/07/06 21:34:20 curt
221 // Added an enable/disable splash screen option.
222 // Added an enable/disable intro music option.
223 // Added an enable/disable instrument panel option.
224 // Added an enable/disable mouse pointer option.
225 // Added using namespace std for compilers that support this.
227 // Revision 1.9 1998/06/27 16:54:34 curt
228 // Replaced "extern displayInstruments" with a entry in fgOPTIONS.
229 // Don't change the view port when displaying the panel.
231 // Revision 1.8 1998/05/16 13:08:36 curt
232 // C++ - ified views.[ch]xx
233 // Shuffled some additional view parameters into the fgVIEW class.
234 // Changed tile-radius to tile-diameter because it is a much better
236 // Added a WORLD_TO_EYE transformation to views.cxx. This allows us
237 // to transform world space to eye space for view frustum culling.
239 // Revision 1.7 1998/05/13 18:29:59 curt
240 // Added a keyboard binding to dynamically adjust field of view.
241 // Added a command line option to specify fov.
242 // Adjusted terrain color.
243 // Root path info moved to fgOPTIONS.
244 // Added ability to parse options out of a config file.
246 // Revision 1.6 1998/05/06 03:16:26 curt
247 // Added an averaged global frame rate counter.
248 // Added an option to control tile radius.
250 // Revision 1.5 1998/05/03 00:47:32 curt
251 // Added an option to enable/disable full-screen mode.
253 // Revision 1.4 1998/04/30 12:34:19 curt
254 // Added command line rendering options:
255 // enable/disable fog/haze
256 // specify smooth/flat shading
257 // disable sky blending and just use a solid color
258 // enable wireframe drawing mode
260 // Revision 1.3 1998/04/28 01:20:23 curt
261 // Type-ified fgTIME and fgVIEW.
262 // Added a command line option to disable textures.
264 // Revision 1.2 1998/04/25 15:11:13 curt
265 // Added an command line option to set starting position based on airport ID.
267 // Revision 1.1 1998/04/24 00:49:21 curt
268 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
269 // Trying out some different option parsing code.
270 // Some code reorganization.