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++
35 #define FG_OPTIONS_OK 0
36 #define FG_OPTIONS_HELP 1
37 #define FG_OPTIONS_ERROR 2
42 // The flight gear "root" directory
45 // Starting position and orientation
46 char airport_id[5]; // ID of initial starting airport
47 double lon; // starting longitude in degrees (west = -)
48 double lat; // starting latitude in degrees (south = -)
49 double altitude; // starting altitude in meters
50 double heading; // heading (yaw) angle in degress (Psi)
51 double roll; // roll angle in degrees (Phi)
52 double pitch; // pitch angle in degrees (Theta)
55 int game_mode; // Game mode enabled/disabled
56 int splash_screen; // show splash screen
57 int intro_music; // play introductory music
58 int mouse_pointer; // show mouse pointer
59 int pause; // pause intially enabled/disabled
62 int hud_status; // HUD on/off
63 int panel_status; // Panel on/off
64 int sound; // play sound effects
66 // Flight Model options
67 int flight_model; // Flight Model: FG_SLEW, FG_LARCSIM, etc.
70 int fog; // Fog enabled/disabled
71 double fov; // Field of View
72 int fullscreen; // Full screen mode enabled/disabled
73 int shading; // shading method, 0 = Flat, 1 = Smooth
74 int skyblend; // Blend sky to haze (using polygons) or just clear
75 int textures; // Textures enabled/disabled
76 int wireframe; // Wireframe mode enabled/disabled
79 int tile_radius; // Square radius of rendered tiles (around center
81 int tile_diameter; // Diameter of rendered tiles. for instance
82 // if tile_diameter = 3 then a 3 x 3 grid of tiles will
83 // be drawn. Increase this to see terrain that is
87 int time_offset; // Offset true time by this many seconds
94 // Parse a single option
95 int parse_option( char *arg );
97 // Parse the command line options
98 int parse_command_line( int argc, char **argv );
100 // Parse the command line options
101 int parse_config_file( char *path );
103 // Print usage message
107 void get_fg_root(char *root);
108 void get_airport_id(char *id);
109 double get_lon( void );
110 double get_lat( void );
111 double get_altitude( void );
112 double get_heading( void );
113 double get_roll( void );
114 double get_pitch( void );
115 int get_game_mode( void );
116 int get_splash_screen( void );
117 int get_intro_music( void );
118 int get_mouse_pointer( void );
119 int get_pause( void );
120 int get_hud_status( void );
121 int get_panel_status( void );
122 int get_sound( void );
123 int get_flight_model( void );
125 double get_fov( void );
126 int get_fullscreen( void );
127 int get_shading( void );
128 int get_skyblend( void );
129 int get_textures( void );
130 int get_wireframe( void );
131 int get_tile_radius( void );
132 int get_tile_diameter( void );
133 int get_time_offset( void );
136 void set_hud_status( int status );
137 void set_fov( double amount );
145 extern fgOPTIONS current_options;
148 #endif /* _OPTIONS_HXX */
152 // Revision 1.14 1998/08/20 15:10:35 curt
153 // Added GameGLUT support.
155 // Revision 1.13 1998/07/30 23:48:29 curt
156 // Output position & orientation when pausing.
157 // Eliminated libtool use.
158 // Added options to specify initial position and orientation.
159 // Changed default fov to 55 degrees.
160 // Added command line option to start in paused or unpaused state.
162 // Revision 1.12 1998/07/27 18:41:26 curt
163 // Added a pause command "p"
164 // Fixed some initialization order problems between pui and glut.
165 // Added an --enable/disable-sound option.
167 // Revision 1.11 1998/07/13 21:01:39 curt
168 // Wrote access functions for current fgOPTIONS.
170 // Revision 1.10 1998/07/06 21:34:20 curt
171 // Added an enable/disable splash screen option.
172 // Added an enable/disable intro music option.
173 // Added an enable/disable instrument panel option.
174 // Added an enable/disable mouse pointer option.
175 // Added using namespace std for compilers that support this.
177 // Revision 1.9 1998/06/27 16:54:34 curt
178 // Replaced "extern displayInstruments" with a entry in fgOPTIONS.
179 // Don't change the view port when displaying the panel.
181 // Revision 1.8 1998/05/16 13:08:36 curt
182 // C++ - ified views.[ch]xx
183 // Shuffled some additional view parameters into the fgVIEW class.
184 // Changed tile-radius to tile-diameter because it is a much better
186 // Added a WORLD_TO_EYE transformation to views.cxx. This allows us
187 // to transform world space to eye space for view frustum culling.
189 // Revision 1.7 1998/05/13 18:29:59 curt
190 // Added a keyboard binding to dynamically adjust field of view.
191 // Added a command line option to specify fov.
192 // Adjusted terrain color.
193 // Root path info moved to fgOPTIONS.
194 // Added ability to parse options out of a config file.
196 // Revision 1.6 1998/05/06 03:16:26 curt
197 // Added an averaged global frame rate counter.
198 // Added an option to control tile radius.
200 // Revision 1.5 1998/05/03 00:47:32 curt
201 // Added an option to enable/disable full-screen mode.
203 // Revision 1.4 1998/04/30 12:34:19 curt
204 // Added command line rendering options:
205 // enable/disable fog/haze
206 // specify smooth/flat shading
207 // disable sky blending and just use a solid color
208 // enable wireframe drawing mode
210 // Revision 1.3 1998/04/28 01:20:23 curt
211 // Type-ified fgTIME and fgVIEW.
212 // Added a command line option to disable textures.
214 // Revision 1.2 1998/04/25 15:11:13 curt
215 // Added an command line option to set starting position based on airport ID.
217 // Revision 1.1 1998/04/24 00:49:21 curt
218 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
219 // Trying out some different option parsing code.
220 // Some code reorganization.