// some of Norman's crazy optimizations. :-)
#ifndef WIN32
- typedef struct {
- int x, y;
- } POINT;
+typedef struct {
+ int x, y;
+} POINT;
- typedef struct {
- int top, bottom, left, right;
- } RECT;
+typedef struct {
+ int top, bottom, left, right;
+} RECT;
#endif
// View mode definitions
extern float get_rudderval ( void );
extern float get_speed ( void );
extern float get_aoa ( void );
+extern float get_nlf ( void );
extern float get_roll ( void );
extern float get_pitch ( void );
extern float get_heading ( void );
extern void fgHUDReshape(void);
enum hudinstype{ HUDno_instr,
- HUDscale,
- HUDlabel,
- HUDladder,
- HUDcirc_ladder,
- HUDhorizon,
- HUDgauge,
- HUDdual_inst,
- HUDmoving_scale,
- HUDtbi
- };
+ HUDscale,
+ HUDlabel,
+ HUDladder,
+ HUDcirc_ladder,
+ HUDhorizon,
+ HUDgauge,
+ HUDdual_inst,
+ HUDmoving_scale,
+ HUDtbi
+};
typedef struct gltagRGBTRIPLE { // rgbt
GLfloat Blue;
int getStringWidth ( char *str )
{
- if ( HUDtext && str )
- {
+ if ( HUDtext && str ) {
float r, l ;
guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
return FloatToInt( r - l );
int StringWidth (void )
{
- if ( HUDtext && strlen( msg ))
- {
+ if ( HUDtext && strlen( msg )) {
float r, l ;
guiFntHandle->getBBox ( msg, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
return FloatToInt( r - l );
char *t=msg;
int p=4;
- if(t[0]=='-') //if negative value then increase the c and p values for '-' sign.
- {
- c++;
+ if(t[0]=='-') {
+ //if negative value then increase the c and p values
+ //for '-' sign. c++;
p++;
}
char *tmp=msg;
fnt->puts(tmp1);
fnt->setPointSize(12);
- char tmp2[p1+1];
+ char tmp2[64];
strncpy(tmp2,msg,p1);
tmp2[p1]='\0';
void Draw()
{
- puDrawString ( guiFnt, msg, FloatToInt(x), FloatToInt(y) );
+ guiFnt.drawString( msg, FloatToInt(x), FloatToInt(y) );
}
};
~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();
- }
- glEnd();
- }
-/* 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();
- } */
+ }
+ /* 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();
+ } */
};
class fgTextList {
class instr_item { // An Abstract Base Class (ABC)
- private:
+private:
static UINT instances; // More than 64K instruments? Nah!
static int brightness;
static glRGBTRIPLE color;
UINT handle;
RECT scrn_pos; // Framing - affects scale dimensions
- // and orientation. Vert vs Horz, etc.
+ // and orientation. Vert vs Horz, etc.
FLTFNPTR load_value_fn;
float disp_factor; // Multiply by to get numbers shown on scale.
UINT opts;
POINT mid_span; //
int digits; //suma
- public:
+public:
instr_item( int x,
int y,
UINT height,
UINT huds_vert (UINT options) { return( options & HUDS_VERT ); }
UINT huds_left (UINT options) { return( options & HUDS_LEFT ); }
UINT huds_right (UINT options) { return( options & HUDS_RIGHT ); }
- UINT huds_both (UINT options) { return( (options & HUDS_BOTH) == HUDS_BOTH ); }
+ UINT huds_both (UINT options) {
+ return( (options & HUDS_BOTH) == HUDS_BOTH );
+ }
UINT huds_noticks (UINT options) { return( options & HUDS_NOTICKS ); }
UINT huds_notext (UINT options) { return( options & HUDS_NOTEXT ); }
UINT huds_top (UINT options) { return( options & HUDS_TOP ); }
}
int getStringWidth ( char *str )
{
- if ( HUDtext && str )
- {
+ if ( HUDtext && str ) {
float r, l ;
guiFntHandle->getBBox ( str, HUD_TextSize, 0, &l, &r, NULL, NULL ) ;
return FloatToInt( r - l );
{
glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle
for(int count=0; count<25; count++) {
- float cosine = r * cos(count * 2 * M_PI/10.0);
- float sine = r * sin(count * 2 * M_PI/10.0);
+ float cosine = r * cos(count * 2 * SG_PI/10.0);
+ float sine = r * sin(count * 2 * SG_PI/10.0);
glVertex2f(cosine+x1, sine+y1);
}
glEnd();
class instr_label : public instr_item {
- private:
+private:
const char *pformat;
const char *pre_str;
const char *post_str;
bool lon;
bool lbox;
- public:
+public:
instr_label( int x,
int y,
UINT width,
class lat_label : public instr_item {
- private:
+private:
const char *pformat;
const char *pre_str;
const char *post_str;
int blink;
char format_buffer[80];
- public:
+public:
lat_label( int x,
int y,
UINT width,
typedef lat_label * pLatlabel;
class lon_label : public instr_item {
- private:
+private:
const char *pformat;
const char *pre_str;
const char *post_str;
int blink;
char format_buffer[80];
- public:
+public:
lon_label( int x,
int y,
UINT width,
//
class instr_scale : public instr_item {
- private:
+private:
float range_shown; // Width Units.
float Maximum_value; // ceiling.
float Minimum_value; // Representation floor.
UINT Modulo; // Roll over point
int signif_digits; // digits to show to the right.
- public:
+public:
instr_scale( int x,
int y,
UINT width,
// line.
class hud_card : public instr_scale {
- private:
+private:
float val_span;
string type;
float half_width_units;
UINT Min_div; //suma
- public:
+public:
hud_card( int x,
int y,
UINT width,
~hud_card();
hud_card( const hud_card & image);
hud_card & operator = (const hud_card & rhs );
-// virtual void display_enable( bool setting );
+ // virtual void display_enable( bool setting );
virtual void draw( void ); // Required method in base class
void circles(float,float,float); // suma
void fixed(float,float,float,float,float,float); //suma
typedef hud_card * pCardScale;
class gauge_instr : public instr_scale {
- public:
+public:
gauge_instr( int x,
int y,
UINT width,
// for both panel and HUD Turn Bank Indicators.
class dual_instr_item : public instr_item {
- private:
+private:
FLTFNPTR alt_data_source;
- public:
+public:
dual_instr_item ( int x,
int y,
UINT width,
class fgTBI_instr : public dual_instr_item
{
- private:
+private:
UINT BankLimit;
UINT SlewLimit;
UINT scr_hole;
bool tsi; //suma
float rad; //suma
- public:
+public:
fgTBI_instr( int x,
int y,
UINT width,
typedef fgTBI_instr * pTBI;
class HudLadder : public dual_instr_item {
- private:
+private:
UINT width_units;
int div_units;
UINT minor_div;
fgLineList LineList;
fgLineList StippleLineList;
- public:
+public:
HudLadder( string name,
int x,
int y,