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