1
0
Fork 0

HUD updates/cleanups from Norman Vine.

This commit is contained in:
curt 2000-05-13 00:02:43 +00:00
parent 5127740c72
commit 365b26d093
16 changed files with 172 additions and 320 deletions

View file

@ -57,11 +57,6 @@
// cockpit/panel/hud system
static pCockpit ac_cockpit;
fntRenderer *HUDtext = 0;
float HUD_TextSize = 0;
int HUD_style = 0;
float HUD_matrix[16];
// The following routines obtain information concerntin the aircraft's
// current state and return it to calling instrument display routines.
// They should eventually be member functions of the aircraft.
@ -466,28 +461,20 @@ bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
" Code " << ac_cockpit->code() << " Status "
<< ac_cockpit->status() );
// HUD_TextSize = (current_options.get_xsize() > 1000) ? 10 : 8;
HUD_TextSize = 10;
HUDtext = new fntRenderer();
HUDtext -> setFont ( guiFntHandle ) ;
HUDtext -> setPointSize ( HUD_TextSize ) ;
HUD_TextList.setFont( HUDtext );
return true;
return true;
}
void fgCockpitUpdate( void ) {
int iwidth = current_view.get_winWidth();
int iheight = current_view.get_winHeight();
float width = iwidth;
float height = iheight;
FG_LOG( FG_COCKPIT, FG_DEBUG,
"Cockpit: code " << ac_cockpit->code() << " status "
<< ac_cockpit->status() );
int iwidth = current_view.get_winWidth();
int iheight = current_view.get_winHeight();
float width = iwidth;
float height = iheight;
if ( current_options.get_hud_status() ) {
// This will check the global hud linked list pointer.
// If these is anything to draw it will.

View file

@ -38,14 +38,10 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_VALUES_H
# include <values.h> // for MAXINT
#endif
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/fg_random.h>
#include <simgear/math/polar3d.hxx>
//#include <simgear/math/fg_random.h>
//#include <simgear/math/polar3d.hxx>
#include <Aircraft/aircraft.hxx>
#include <Autopilot/newauto.hxx>
@ -55,7 +51,7 @@
#include <NetworkOLK/network.h>
#endif
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
//#include <Time/fg_timer.hxx>
#if defined ( __sun__ ) || defined ( __sgi )
extern "C" {
@ -78,7 +74,13 @@ fgTextList HUD_TextList;
fgLineList HUD_LineList;
fgLineList HUD_StippleLineList;
float hud_trans_alpha = 0.5f;
fntRenderer *HUDtext = 0;
float HUD_TextSize = 0;
int HUD_style = 0;
float HUD_matrix[16];
static float hud_trans_alpha = 0.67f;
void fgHUDalphaInit( void );
class locRECT {
@ -99,6 +101,7 @@ locRECT :: locRECT( UINT left, UINT top, UINT right, UINT bottom)
}
// #define DEBUG
#ifdef OLD_CODE
void drawOneLine( UINT x1, UINT y1, UINT x2, UINT y2)
{
glBegin(GL_LINES);
@ -125,7 +128,6 @@ void textString( int x, int y, char *msg, void *font ){
if(*msg)
{
// puDrawString ( NULL, msg, x, y );
glRasterPos2f(x, y);
while (*msg) {
glutBitmapCharacter(font, *msg);
@ -171,6 +173,7 @@ int getStringWidth ( char *str )
}
return 0 ;
}
#endif // OLD_CODE
//========================= End of Class Implementations===================
// fgHUDInit
@ -188,7 +191,6 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
{
instr_item *HIptr;
// int index;
int font_size;
// int off = 50;
int min_x = 25; //off/2;
@ -204,7 +206,8 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
int compass_w = 200;
int gap = 10;
font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
// int font_size = current_options.get_xsize() / 60;
int font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
HUD_style = 1;
@ -658,6 +661,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
// while( HIptr );
fgHUDalphaInit();
fgHUDReshape();
return 0; // For now. Later we may use this for an error code.
}
@ -666,7 +670,6 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
{
// instr_item *HIptr;
// int index;
int font_size;
int off = 50;
// int min_x = off;
@ -682,7 +685,8 @@ int fgHUDInit2( fgAIRCRAFT * /* current_aircraft */ )
int compass_w = 200;
// int gap = 10;
font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
// int font_size = current_options.get_xsize() / 60;
int font_size = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
HUD_style = 2;
@ -1029,15 +1033,11 @@ int brightness = pHUDInstr->get_brightness();
#define fgAP_CLAMP(val,min,max) ( (val) = (val) > (max) ? (max) : (val) < (min) ? (min) : (val) )
static puDialogBox *HUDalphaDialog;
static puFrame *HUDalphaFrame;
static puText *HUDalphaDialogMessage;
static puText *HUDalphaTitle;
static puText *HUDalphaText;
static puOneShot *HUDalphaOkButton;
static puSlider *HUDalphaHS0;
static puFont HUDalphaLegendFont;
static puFont HUDalphaLabelFont;
static char SliderText[1][ 8 ];
//static puText *HUDtextText;
//static puSlider *HUDalphaHS1;
static char SliderText[2][ 8 ];
static void alpha_adj( puObject *hs ) {
float val ;
@ -1051,6 +1051,7 @@ static void alpha_adj( puObject *hs ) {
}
void fgHUDalphaAdjust( puObject * ) {
current_options.set_anti_alias_hud(1);
FG_PUSH_PUI_DIALOG( HUDalphaDialog );
}
@ -1059,41 +1060,51 @@ static void goAwayHUDalphaAdjust (puObject *)
FG_POP_PUI_DIALOG( HUDalphaDialog );
}
static void cancelHUDalphaAdjust (puObject *)
{
current_options.set_anti_alias_hud(0);
FG_POP_PUI_DIALOG( HUDalphaDialog );
}
// Done once at system initialization
void fgHUDalphaInit( void ) {
// printf("fgAPAdjustInit\n");
// printf("fgHUDalphaInit\n");
#define HORIZONTAL FALSE
int DialogX = 40;
int DialogY = 100;
int DialogWidth = 230;
int DialogWidth = 240;
char Label[] = "HUD Alpha Adjust";
char Label[] = "HUD Adjuster";
char *s;
int labelX = (DialogWidth / 2) -
(puGetStringWidth( puGetDefaultLabelFont(), Label ) / 2);
labelX -= 30; // KLUDGEY
int nSliders = 1;
int slider_x = 10;
int slider_y = 55;
int slider_width = 210;
int slider_width = 220;
int slider_title_x = 15;
int slider_value_x = 160;
float slider_delta = 0.05f;
puGetDefaultFonts ( &HUDalphaLegendFont, &HUDalphaLabelFont );
puFont HUDalphaLegendFont;
puFont HUDalphaLabelFont;
puGetDefaultFonts ( &HUDalphaLegendFont, &HUDalphaLabelFont );
HUDalphaDialog = new puDialogBox ( DialogX, DialogY ); {
int horiz_slider_height = puGetStringHeight (HUDalphaLabelFont) +
puGetStringDescender (HUDalphaLabelFont) +
PUSTR_TGAP + PUSTR_BGAP + 5;
puFrame *
HUDalphaFrame = new puFrame ( 0, 0,
DialogWidth,
85 + nSliders * horiz_slider_height );
puText *
HUDalphaDialogMessage = new puText ( labelX,
52 + nSliders
* horiz_slider_height );
@ -1103,30 +1114,57 @@ void fgHUDalphaInit( void ) {
HUDalphaHS0 = new puSlider ( slider_x, slider_y,
slider_width, HORIZONTAL ) ;
HUDalphaHS0-> setDelta ( slider_delta ) ;
HUDalphaHS0-> setValue ( hud_trans_alpha ) ;
HUDalphaHS0-> setCBMode ( PUSLIDER_DELTA ) ;
HUDalphaHS0-> setCallback ( alpha_adj ) ;
HUDalphaHS0-> setDelta ( slider_delta ) ;
HUDalphaHS0-> setValue ( hud_trans_alpha ) ;
HUDalphaHS0-> setCBMode ( PUSLIDER_DELTA ) ;
HUDalphaHS0-> setCallback ( alpha_adj ) ;
sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha );
HUDalphaTitle = new puText ( slider_title_x, slider_y ) ;
HUDalphaTitle-> setDefaultValue ( "MaxAlpha" ) ;
puText *
HUDalphaTitle = new puText ( slider_title_x, slider_y ) ;
HUDalphaTitle-> setDefaultValue ( "Alpha" ) ;
HUDalphaTitle-> getDefaultValue ( &s ) ;
HUDalphaTitle-> setLabel ( s ) ;
HUDalphaTitle-> setLabel ( s ) ;
HUDalphaText = new puText ( slider_value_x, slider_y ) ;
sprintf( SliderText[ 0 ], "%05.2f", hud_trans_alpha );
HUDalphaText-> setLabel ( SliderText[ 0 ] ) ;
HUDalphaOkButton = new puOneShot ( 10, 10, 60, 50 );
HUDalphaOkButton-> setLegend ( gui_msg_OK );
puOneShot *
HUDalphaOkButton = new puOneShot ( 10, 10, 60, 45 );
HUDalphaOkButton-> setLegend ( gui_msg_OK );
HUDalphaOkButton-> makeReturnDefault ( TRUE );
HUDalphaOkButton-> setCallback ( goAwayHUDalphaAdjust );
HUDalphaOkButton-> setCallback ( goAwayHUDalphaAdjust );
puOneShot *
HUDalphaNoButton = new puOneShot ( 160, 10, 230, 45 );
HUDalphaNoButton-> setLegend ( gui_msg_CANCEL );
HUDalphaNoButton-> setCallback ( cancelHUDalphaAdjust );
}
FG_FINALIZE_PUI_DIALOG( HUDalphaDialog );
#undef HORIZONTAL
}
void fgHUDReshape(void) {
if ( HUDtext )
delete HUDtext;
HUD_TextSize = current_options.get_xsize() / 60;
// HUD_TextSize = 10;
HUDtext = new fntRenderer();
HUDtext -> setFont ( guiFntHandle ) ;
HUDtext -> setPointSize ( HUD_TextSize ) ;
HUD_TextList.setFont( HUDtext );
}
static void set_hud_color(float r, float g, float b) {
current_options.get_anti_alias_hud() ?
glColor4f(r,g,b,hud_trans_alpha) :
glColor3f(r,g,b);
}
// fgUpdateHUD
//
// Performs a once around the list of calls to instruments installed in
@ -1162,65 +1200,59 @@ void fgUpdateHUD( void ) {
glPushMatrix();
glLoadIdentity();
glColor3f(1.0, 1.0, 1.0);
glIndexi(7);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
// #define ANTI_ALIAS_HUD
#ifdef ANTI_ALIAS_HUD
#define HUD_COLOR(r,g,b) glColor4f(r,g,b,hud_trans_alpha)
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_LINE_SMOOTH_HINT,GL_DONT_CARE);
glLineWidth(1.5);
#else
#define HUD_COLOR(r,g,b) glColor3f(r,g,b)
glLineWidth(1.0);
#endif
if( current_options.get_anti_alias_hud() ) {
glEnable(GL_LINE_SMOOTH);
// glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_LINE_SMOOTH_HINT,GL_DONT_CARE);
glLineWidth(1.5);
} else {
glLineWidth(1.0);
}
if( day_night_sw == DAY) {
switch (brightness) {
case BRT_LIGHT:
HUD_COLOR (0.1f, 0.9f, 0.1f);
set_hud_color (0.1f, 0.9f, 0.1f);
break;
case BRT_MEDIUM:
HUD_COLOR (0.1f, 0.7f, 0.0f);
set_hud_color (0.1f, 0.7f, 0.0f);
break;
case BRT_DARK:
HUD_COLOR (0.0f, 0.6f, 0.0f);
set_hud_color (0.0f, 0.6f, 0.0f);
break;
case BRT_BLACK:
HUD_COLOR( 0.0f, 0.0f, 0.0f);
set_hud_color( 0.0f, 0.0f, 0.0f);
break;
default:
HUD_COLOR (0.1f, 0.9f, 0.1f);
set_hud_color (0.1f, 0.9f, 0.1f);
}
}
else {
if( day_night_sw == NIGHT) {
switch (brightness) {
case BRT_LIGHT:
HUD_COLOR (0.9f, 0.1f, 0.1f);
set_hud_color (0.9f, 0.1f, 0.1f);
break;
case BRT_MEDIUM:
HUD_COLOR (0.7f, 0.0f, 0.1f);
set_hud_color (0.7f, 0.0f, 0.1f);
break;
case BRT_DARK:
default:
HUD_COLOR (0.6f, 0.0f, 0.0f);
set_hud_color (0.6f, 0.0f, 0.0f);
}
}
else { // Just in case default
HUD_COLOR (0.1f, 0.9f, 0.1f);
set_hud_color (0.1f, 0.9f, 0.1f);
}
}
@ -1234,8 +1266,6 @@ void fgUpdateHUD( void ) {
// fgPrintf( FG_COCKPIT, FG_DEBUG, "HUD Code %d Status %d\n",
// hud->code, hud->status );
pHUDInstr->draw();
// HUD_deque.at(i)->draw(); // Responsible for broken or fixed variants.
// No broken displays honored just now.
}
}
@ -1291,12 +1321,11 @@ void fgUpdateHUD( void ) {
// HUD_StippleLineList.draw();
// glDisable(GL_LINE_STIPPLE);
#ifdef ANTI_ALIAS_HUD
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glLineWidth(1.0);
#endif
if( current_options.get_anti_alias_hud() ) {
// glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
glLineWidth(1.0);
}
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);

View file

@ -40,9 +40,9 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_VALUES_H
# include <values.h> // for MAXINT
#endif
//#ifdef HAVE_VALUES_H
//# include <values.h> // for MAXINT
//#endif
#include <vector> // STL vector
#include <deque> // STL double ended queue
@ -190,6 +190,7 @@ extern char *coord_format_lon(float);
//extern char *coord_format_latlon(float latitude, float longitude); // cockpit.cxx
extern char *get_formated_gmt_time( void );
extern void fgHUDReshape(void);
enum hudinstype{ HUDno_instr,
HUDscale,
@ -297,32 +298,28 @@ public:
~fgLineList( void ) {}
void add( fgLineSeg2D seg ) { List.push_back(seg); }
void erase( void ) { List.erase( List.begin(), List.end() ); }
void draw( void ) {
vector < fgLineSeg2D > :: iterator curSeg;
vector < fgLineSeg2D > :: iterator lastSeg;
curSeg = List.begin();
lastSeg = List.end();
glBegin(GL_LINES);
for ( ; curSeg != lastSeg; curSeg++ ) {
curSeg->draw();
void draw( void ) {
vector < fgLineSeg2D > :: iterator curSeg;
vector < fgLineSeg2D > :: iterator lastSeg;
curSeg = List.begin();
lastSeg = List.end();
glBegin(GL_LINES);
for ( ; curSeg != lastSeg; curSeg++ ) {
curSeg->draw();
}
glEnd();
}
glEnd();
}
#if 0
void draw( void ) {
/* void draw( void ) {
vector < fgLineSeg2D > :: iterator curSeg;
vector < fgLineSeg2D > :: iterator lastSeg;
curSeg = List.begin();
curSeg = List.begin();
lastSeg = List.end();
glBegin(GL_LINES);
for ( ; curSeg != lastSeg; curSeg++ ) {
curSeg->draw();
}
glEnd();
}
#endif
} */
};
class fgTextList {

View file

@ -1,21 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <simgear/constants.h>
#include <simgear/math/fg_random.h>
#include <simgear/math/polar3d.hxx>
#include <Aircraft/aircraft.hxx>
#include <GUI/gui.h>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include "hud.hxx"

View file

@ -1,21 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <simgear/constants.h>
#include <simgear/math/fg_random.h>
#include <simgear/math/polar3d.hxx>
#include <Aircraft/aircraft.hxx>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include "hud.hxx"

View file

@ -1,22 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <simgear/constants.h>
#include <simgear/math/fg_random.h>
#include <simgear/math/polar3d.hxx>
#include <Aircraft/aircraft.hxx>
#include <GUI/gui.h>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include "hud.hxx"
@ -110,11 +91,11 @@ void guage_instr :: draw (void)
char TextScale[80];
bool condition;
int disp_val = 0;
float vmin = min_val();
float vmax = max_val();
POINT mid_scr = get_centroid();
float cur_value = get_value();
RECT scrn_rect = get_location();
float vmin = min_val();
float vmax = max_val();
POINT mid_scr = get_centroid();
float cur_value = get_value();
RECT scrn_rect = get_location();
UINT options = get_options();
width = scrn_rect.left + scrn_rect.right;

View file

@ -1,23 +1,3 @@
// Abstract Base Class instr_item
//
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <simgear/constants.h>
#include <simgear/math/fg_random.h>
#include <simgear/math/polar3d.hxx>
#include <Aircraft/aircraft.hxx>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include "hud.hxx"

View file

@ -1,22 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <simgear/constants.h>
#include <simgear/math/fg_random.h>
#include <simgear/math/polar3d.hxx>
#include <Aircraft/aircraft.hxx>
#include <GUI/gui.h>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include "hud.hxx"

View file

@ -1,22 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <simgear/constants.h>
#include <simgear/math/fg_random.h>
#include <simgear/math/polar3d.hxx>
#include <Aircraft/aircraft.hxx>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include <GUI/gui.h>
#include "hud.hxx"

View file

@ -1,22 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <simgear/constants.h>
#include <simgear/math/fg_random.h>
#include <simgear/math/polar3d.hxx>
#include <Aircraft/aircraft.hxx>
#include <GUI/gui.h>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include "hud.hxx"
@ -126,14 +107,16 @@ draw( void ) // Required method in base class
int posincr;
int lenstr;
RECT scrn_rect = get_location();
float lat = get_value();
// float lat = get_value();
if( data_available() ) {
sprintf( label_buffer, format_buffer, coord_format_lat(lat) );
// sprintf( label_buffer, format_buffer, coord_format_lat(lat) );
sprintf( label_buffer, format_buffer,
coord_format_lat( get_value()) );
}
else {
sprintf( label_buffer, format_buffer );
}
}
#ifdef DEBUGHUD
fgPrintf( FG_COCKPIT, FG_DEBUG, format_buffer );
@ -142,14 +125,13 @@ draw( void ) // Required method in base class
fgPrintf( FG_COCKPIT, FG_DEBUG, "\n" );
#endif
lenstr = getStringWidth(label_buffer);
lenstr = getStringWidth(label_buffer);
if( justify == RIGHT_JUST ) {
posincr = scrn_rect.right - lenstr;
}else if( justify == CENTER_JUST ) {
posincr = get_span() - (lenstr/2); // -lenstr*4;
} else {
// justify == LEFT_JUST
posincr = get_span() - (lenstr/2);
} else { // justify == LEFT_JUST
posincr = 0; // 0;
}

View file

@ -1,22 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <simgear/constants.h>
#include <simgear/math/fg_random.h>
#include <simgear/math/polar3d.hxx>
#include <Aircraft/aircraft.hxx>
#include <GUI/gui.h>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include "hud.hxx"
@ -151,10 +132,10 @@ draw( void ) // Required method in base class
if( justify == RIGHT_JUST ) {
posincr = scrn_rect.right - lenstr;
}else if( justify == CENTER_JUST ) {
posincr = get_span() - (lenstr/2); // -lenstr*4;
posincr = get_span() - (lenstr/2);
} else {
// justify == LEFT_JUST
posincr = 0; // 0;
posincr = 0;
}
if( fontSize == SMALL ) {

View file

@ -1,21 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <simgear/constants.h>
#include <simgear/math/fg_random.h>
#include <simgear/math/polar3d.hxx>
#include <Aircraft/aircraft.hxx>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include "hud.hxx"

View file

@ -1,21 +1,3 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <simgear/constants.h>
#include <simgear/math/fg_random.h>
#include <simgear/math/polar3d.hxx>
#include <Aircraft/aircraft.hxx>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include "hud.hxx"

View file

@ -1146,8 +1146,8 @@ void fgReshape( int width, int height ) {
} else {
current_view.set_win_ratio( (GLfloat) width /
((GLfloat) (height)*0.4232) );
glViewport(0, (GLint)((height)*0.5768), (GLint)(width),
(GLint)((height)*0.4232) );
glViewport(0, (GLint)((height)*0.5768),
(GLint)(width), (GLint)((height)*0.4232) );
}
current_view.set_winWidth( width );
@ -1155,14 +1155,16 @@ void fgReshape( int width, int height ) {
current_view.force_update_fov_math();
// set these fov to be the same as in fgRenderFrame()
float x_fov = current_options.get_fov();
float y_fov = x_fov * 1.0 / current_view.get_win_ratio();
ssgSetFOV( x_fov, y_fov );
// float x_fov = current_options.get_fov();
// float y_fov = x_fov * 1.0 / current_view.get_win_ratio();
// ssgSetFOV( x_fov, y_fov );
glViewport ( 0, 0, width, height );
// glViewport ( 0, 0, width, height );
float fov = current_options.get_fov();
ssgSetFOV(fov * current_view.get_win_ratio(), fov);
fgHUDReshape();
if ( idle_state == 1000 ) {
// yes we've finished all our initializations and are running
// the main loop, so this will now work without seg faulting
@ -1199,9 +1201,10 @@ int fgGlutInit( int *argc, char **argv ) {
} else {
// Open the cool new 'game mode' window
char game_mode_str[256];
sprintf( game_mode_str, "width=%d height=%d bpp=32",
sprintf( game_mode_str, "width=%d height=%d bpp=%d",
current_options.get_xsize(),
current_options.get_ysize() );
current_options.get_ysize(),
current_options.get_bpp());
FG_LOG( FG_GENERAL, FG_INFO,
"game mode params = " << game_mode_str );

View file

@ -162,6 +162,7 @@ fgOPTIONS::fgOPTIONS() :
hud_status(1),
panel_status(0),
sound(1),
anti_alias_hud(0),
// Flight Model options
flight_model( FGInterface::FG_LARCSIM ),
@ -181,6 +182,7 @@ fgOPTIONS::fgOPTIONS() :
wireframe(0),
xsize(640),
ysize(480),
bpp(16),
view_mode(FG_VIEW_PILOT),
// Scenery options
@ -250,7 +252,7 @@ fgOPTIONS::toggle_panel() {
}
// fgReshape( xsize, ysize);
fgReshape( current_view.get_winWidth(), current_view.get_winHeight() );
if( !toggle_pause )
t->togglePauseMode();
}
@ -601,6 +603,10 @@ int fgOPTIONS::parse_option( const string& arg ) {
pause = false;
} else if ( arg == "--enable-pause" ) {
pause = true;
} else if ( arg == "--disable-anti-alias-hud" ) {
anti_alias_hud = false;
} else if ( arg == "--enable-anti-alias-hud" ) {
anti_alias_hud = true;
} else if ( arg.find( "--control=") != string::npos ) {
parse_control( arg.substr(10) );
} else if ( arg == "--disable-auto-coordination" ) {
@ -734,6 +740,15 @@ int fgOPTIONS::parse_option( const string& arg ) {
FG_LOG( FG_GENERAL, FG_ALERT,
"Setting geometry to " << xsize << 'x' << ysize << '\n');
}
} else if ( arg.find( "--bpp=" ) != string::npos ) {
string bits_per_pix = arg.substr( 6 );
if ( bits_per_pix == "16" ) {
bpp = 16;
} else if ( bits_per_pix == "24" ) {
bpp = 24;
} else if ( bits_per_pix == "32" ) {
bpp = 32;
}
} else if ( arg == "--units-feet" ) {
units = FG_UNITS_FEET;
} else if ( arg == "--units-meters" ) {
@ -888,6 +903,8 @@ void fgOPTIONS::usage ( void ) {
cout << "\t--enable-panel: enable instrumetn panel" << endl;
cout << "\t--disable-sound: disable sound effects" << endl;
cout << "\t--enable-sound: enable sound effects" << endl;
cout << "\t--disable-anti-alias-hud: disable anti aliased hud" << endl;
cout << "\t--enable-anti-alias-hud: enable anti aliased hud" << endl;
cout << endl;
cout << "Flight Model:" << endl;

View file

@ -153,6 +153,7 @@ private:
bool hud_status; // HUD on/off
bool panel_status; // Panel on/off
bool sound; // play sound effects
bool anti_alias_hud;
// Flight Model options
int flight_model; // Core flight model code: jsb, larcsim, magic, etc.
@ -171,6 +172,7 @@ private:
bool textures; // Textures enabled/disabled
bool wireframe; // Wireframe mode enabled/disabled
int xsize, ysize; // window size derived from geometry string
int bpp; // bits per pixel
fgViewMode view_mode; // view mode
// Scenery options
@ -231,6 +233,7 @@ public:
inline bool get_intro_music() const { return intro_music; }
inline int get_mouse_pointer() const { return mouse_pointer; }
inline bool get_pause() const { return pause; }
inline bool get_anti_alias_hud() const { return anti_alias_hud; }
inline fgControlMode get_control_mode() const { return control_mode; }
inline void set_control_mode( fgControlMode mode ) { control_mode = mode; }
inline fgAutoCoordMode get_auto_coordination() const {
@ -259,6 +262,7 @@ public:
inline bool get_wireframe() const { return wireframe; }
inline int get_xsize() const { return xsize; }
inline int get_ysize() const { return ysize; }
inline int get_bpp() const { return bpp; }
inline fgViewMode get_view_mode() const { return view_mode; }
inline int get_tile_radius() const { return tile_radius; }
inline int get_tile_diameter() const { return tile_diameter; }
@ -293,6 +297,7 @@ public:
inline void set_intro_music (bool value) { intro_music = value; }
inline void set_mouse_pointer (int value) { mouse_pointer = value; }
inline void set_pause (bool value) { pause = value; }
inline void set_anti_alias_hud (bool value) { anti_alias_hud = value; }
inline void set_hud_status( bool status ) { hud_status = status; }
inline void set_sound (bool value) { sound = value; }
inline void set_flight_model (int value) { flight_model = value; }