1 // options.hxx -- class to handle command line options
3 // Written by Curtis Olson, started April 1998.
5 // Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 # error This library requires C++
36 #include <Include/compiler.h>
45 #if defined(FX) && defined(XMESA)
46 extern bool global_fullscreen;
55 typedef vector < string > str_container;
56 typedef str_container::iterator str_iterator;
57 typedef str_container::const_iterator const_str_iterator;
99 // The flight gear "root" directory
102 // Starting position and orientation
103 string airport_id; // ID of initial starting airport
104 double lon; // starting longitude in degrees (west = -)
105 double lat; // starting latitude in degrees (south = -)
106 double altitude; // starting altitude in meters
107 double heading; // heading (yaw) angle in degress (Psi)
108 double roll; // roll angle in degrees (Phi)
109 double pitch; // pitch angle in degrees (Theta)
110 double uBody; // Body axis X velocity (U)
111 double vBody; // Body axis Y velocity (V)
112 double wBody; // Body axis Z velocity (W)
115 bool game_mode; // Game mode enabled/disabled
116 bool splash_screen; // show splash screen
117 bool intro_music; // play introductory music
118 int mouse_pointer; // show mouse pointer
119 bool pause; // pause intially enabled/disabled
120 fgControlMode control_mode; // primary control mode
123 bool hud_status; // HUD on/off
124 bool panel_status; // Panel on/off
125 bool sound; // play sound effects
127 // Flight Model options
128 int flight_model; // Flight Model: FG_SLEW, FG_LARCSIM, etc.
129 int speed_up; // Sim mechanics run this much faster than normal speed
132 fgFogKind fog; // Fog nicest/fastest/disabled
133 double fov; // Field of View
134 bool fullscreen; // Full screen mode enabled/disabled
135 int shading; // shading method, 0 = Flat, 1 = Smooth
136 bool skyblend; // Blend sky to haze (using polygons) or just clear
137 bool textures; // Textures enabled/disabled
138 bool wireframe; // Wireframe mode enabled/disabled
139 int xsize, ysize; // window size derived from geometry string
142 int tile_radius; // Square radius of rendered tiles (around center
144 int tile_diameter; // Diameter of rendered tiles. for instance
145 // if tile_diameter = 3 then a 3 x 3 grid of tiles will
146 // be drawn. Increase this to see terrain that is
150 int units; // feet or meters
154 int time_offset; // Offset true time by this many seconds
155 long int start_gst; // Specify a greenwich sidereal time (gst)
156 long int start_lst; // Specify a local sidereal time (lst)
158 // Serial Ports, we currently support up to four channels
159 // fgSerialPortKind port_a_kind; // Port a kind
160 // fgSerialPortKind port_b_kind; // Port b kind
161 // fgSerialPortKind port_c_kind; // Port c kind
162 // fgSerialPortKind port_d_kind; // Port d kind
164 // Serial port configuration strings
165 str_container port_options_list;
175 // Parse a single option
176 int parse_option( const string& arg );
178 // Parse the command line options
179 int parse_command_line( int argc, char **argv );
181 // Parse the command line options
182 int parse_config_file( const string& path );
184 // Print usage message
188 inline string get_fg_root() const { return fg_root; }
189 inline string get_airport_id() const { return airport_id; }
190 inline double get_lon() const { return lon; }
191 inline double get_lat() const { return lat; }
192 inline double get_altitude() const { return altitude; }
193 inline double get_heading() const { return heading; }
194 inline double get_roll() const { return roll; }
195 inline double get_pitch() const { return pitch; }
196 inline double get_uBody() const {return uBody;}
197 inline double get_vBody() const {return vBody;}
198 inline double get_wBody() const {return wBody;}
199 inline bool get_game_mode() const { return game_mode; }
200 inline bool get_splash_screen() const { return splash_screen; }
201 inline bool get_intro_music() const { return intro_music; }
202 inline int get_mouse_pointer() const { return mouse_pointer; }
203 inline bool get_pause() const { return pause; }
204 inline fgControlMode get_control_mode() const { return control_mode; }
205 inline void set_control_mode( fgControlMode mode ) { control_mode = mode; }
206 inline bool get_hud_status() const { return hud_status; }
207 inline bool get_panel_status() const { return panel_status; }
208 inline bool get_sound() const { return sound; }
209 inline int get_flight_model() const { return flight_model; }
210 inline int get_speed_up() const { return speed_up; }
211 inline void set_speed_up( int speed ) { speed_up = speed; }
212 inline bool fog_enabled() const { return fog != FG_FOG_DISABLED; }
213 inline fgFogKind get_fog() const { return fog; }
214 inline double get_fov() const { return fov; }
215 inline bool get_fullscreen() const { return fullscreen; }
216 inline int get_shading() const { return shading; }
217 inline bool get_skyblend() const { return skyblend; }
218 inline bool get_textures() const { return textures; }
219 inline bool get_wireframe() const { return wireframe; }
220 inline int get_xsize() const { return xsize; }
221 inline int get_ysize() const { return ysize; }
222 inline int get_tile_radius() const { return tile_radius; }
223 inline int get_tile_diameter() const { return tile_diameter; }
225 inline int get_units() const { return units; }
226 inline int get_tris_or_culled() const { return tris_or_culled; }
228 inline int get_time_offset() const { return time_offset; }
229 inline long int get_start_gst() const { return start_gst; };
230 inline long int get_start_lst() const { return start_lst; }
232 inline str_container get_port_options_list() const {
233 return port_options_list;
235 inline string get_net_id() const { return net_id; }
238 inline void set_airport_id( const string id ) { airport_id = id; }
239 inline void set_hud_status( bool status ) { hud_status = status; }
240 inline void set_fov( double amount ) { fov = amount; }
241 inline void set_textures( bool status ) { textures = status; }
242 inline void cycle_fog( void ) {
243 if ( fog == FG_FOG_DISABLED ) {
244 fog = FG_FOG_FASTEST;
245 } else if ( fog == FG_FOG_FASTEST ) {
247 xglHint ( GL_FOG_HINT, GL_NICEST );
248 } else if ( fog == FG_FOG_NICEST ) {
249 fog = FG_FOG_DISABLED;
250 xglHint ( GL_FOG_HINT, GL_FASTEST );
254 inline void set_xsize( int x ) { xsize= x; }
255 inline void set_ysize( int y ) { xsize= y; }
256 inline void set_net_id( const string id ) { net_id = id; }
260 void parse_control( const string& mode );
261 double parse_time( const string& time_str );
262 long int parse_date( const string& date_str );
263 double parse_degree( const string& degree_str );
264 int parse_time_offset( const string& time_str );
265 int parse_tile_radius( const string& arg );
266 int parse_fdm( const string& fm );
267 double parse_fov( const string& arg );
268 bool parse_serial( const string& serial_str );
272 extern fgOPTIONS current_options;
275 #endif /* _OPTIONS_HXX */