HUD format changed contributed by Norman Vine.
This commit is contained in:
parent
41544fe6e5
commit
a9b592c7e9
15 changed files with 2908 additions and 1744 deletions
|
@ -5,6 +5,7 @@ libCockpit_a_SOURCES = \
|
||||||
hud.cxx hud.hxx \
|
hud.cxx hud.hxx \
|
||||||
hud_card.cxx hud_dnst.cxx hud_guag.cxx hud_inst.cxx \
|
hud_card.cxx hud_dnst.cxx hud_guag.cxx hud_inst.cxx \
|
||||||
hud_labl.cxx hud_ladr.cxx \
|
hud_labl.cxx hud_ladr.cxx \
|
||||||
|
hud_lat.cxx hud_lon.cxx \
|
||||||
hud_scal.cxx hud_tbi.cxx \
|
hud_scal.cxx hud_tbi.cxx \
|
||||||
panel.cxx panel.hxx
|
panel.cxx panel.hxx
|
||||||
|
|
||||||
|
|
|
@ -47,11 +47,10 @@
|
||||||
#include <Math/mat3.h>
|
#include <Math/mat3.h>
|
||||||
#include <Math/polar3d.hxx>
|
#include <Math/polar3d.hxx>
|
||||||
#include <Scenery/scenery.hxx>
|
#include <Scenery/scenery.hxx>
|
||||||
#include <Time/fg_time.hxx>
|
|
||||||
#include <Time/fg_timer.hxx>
|
#include <Time/fg_timer.hxx>
|
||||||
|
#include <Time/fg_time.hxx>
|
||||||
|
|
||||||
#include "cockpit.hxx"
|
#include "cockpit.hxx"
|
||||||
#include "panel.hxx"
|
|
||||||
|
|
||||||
|
|
||||||
// This is a structure that contains all data related to
|
// This is a structure that contains all data related to
|
||||||
|
@ -62,42 +61,69 @@ static pCockpit ac_cockpit;
|
||||||
// The following routines obtain information concerntin the aircraft's
|
// The following routines obtain information concerntin the aircraft's
|
||||||
// current state and return it to calling instrument display routines.
|
// current state and return it to calling instrument display routines.
|
||||||
// They should eventually be member functions of the aircraft.
|
// They should eventually be member functions of the aircraft.
|
||||||
|
//
|
||||||
|
|
||||||
double get_latitude( void )
|
float get_latitude( void )
|
||||||
{
|
{
|
||||||
return (double)((int)(current_aircraft.fdm_state->get_Latitude()*RAD_TO_DEG));
|
// FGState *f;
|
||||||
}
|
double lat;
|
||||||
|
|
||||||
double get_lat_min( void )
|
|
||||||
{
|
|
||||||
double a, d;
|
|
||||||
|
|
||||||
a = current_aircraft.fdm_state->get_Latitude() * RAD_TO_DEG;
|
|
||||||
if (a < 0.0) {
|
|
||||||
a = -a;
|
|
||||||
}
|
|
||||||
d = (double) ( (int) a);
|
|
||||||
return( (a - d) * 60.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_longitude( void )
|
|
||||||
{
|
|
||||||
return( (double)((int) (current_aircraft.fdm_state->get_Longitude()
|
|
||||||
* RAD_TO_DEG)) );
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_long_min( void )
|
|
||||||
{
|
|
||||||
double a, d;
|
|
||||||
|
|
||||||
a = current_aircraft.fdm_state->get_Longitude() * RAD_TO_DEG;
|
// current_aircraft.fdm_state
|
||||||
|
|
||||||
|
lat = current_aircraft.fdm_state->get_Latitude() * RAD_TO_DEG;
|
||||||
|
|
||||||
|
float flat = lat;
|
||||||
|
return(flat);
|
||||||
|
|
||||||
|
// if(fabs(lat)<1.0)
|
||||||
|
// {
|
||||||
|
// if(lat<0)
|
||||||
|
// return( -(double)((int)lat) );
|
||||||
|
// else
|
||||||
|
// return( (double)((int)lat) );
|
||||||
|
// }
|
||||||
|
// return( (double)((int)lat) );
|
||||||
|
}
|
||||||
|
float get_lat_min( void )
|
||||||
|
{
|
||||||
|
// FGState *f;
|
||||||
|
double a, d;
|
||||||
|
|
||||||
|
// current_aircraft.fdm_state
|
||||||
|
|
||||||
|
a = current_aircraft.fdm_state->get_Latitude() * RAD_TO_DEG;
|
||||||
if (a < 0.0) {
|
if (a < 0.0) {
|
||||||
a = -a;
|
a = -a;
|
||||||
}
|
}
|
||||||
d = (double) ( (int) a);
|
d = (double) ( (int) a);
|
||||||
return( (a - d) * 60.0);
|
float lat_min = (a - d) * 60.0;
|
||||||
|
return(lat_min );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float get_longitude( void )
|
||||||
|
{
|
||||||
|
double lon;
|
||||||
|
// FGState *f;
|
||||||
|
|
||||||
|
// current_aircraft.fdm_state
|
||||||
|
|
||||||
|
lon = current_aircraft.fdm_state->get_Longitude() * RAD_TO_DEG;
|
||||||
|
|
||||||
|
float flon = lon;
|
||||||
|
return(flon);
|
||||||
|
|
||||||
|
// if(fabs(lon)<1.0)
|
||||||
|
// {
|
||||||
|
// if(lon<0)
|
||||||
|
// return( -(double)((int)lon) );
|
||||||
|
// else
|
||||||
|
// return( (double)((int)lon) );
|
||||||
|
// }
|
||||||
|
// return( (double)((int)lon) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
get_formated_gmt_time( void )
|
get_formated_gmt_time( void )
|
||||||
{
|
{
|
||||||
|
@ -105,124 +131,454 @@ get_formated_gmt_time( void )
|
||||||
FGTime *t = FGTime::cur_time_params;
|
FGTime *t = FGTime::cur_time_params;
|
||||||
const struct tm *p = t->getGmt();
|
const struct tm *p = t->getGmt();
|
||||||
sprintf( buf, "%d/%d/%2d %d:%02d:%02d",
|
sprintf( buf, "%d/%d/%2d %d:%02d:%02d",
|
||||||
p->tm_mon+1, p->tm_mday, p->tm_year,
|
p->tm_mon+1, p->tm_mday, p->tm_year,
|
||||||
p->tm_hour, p->tm_min, p->tm_sec);
|
p->tm_hour, p->tm_min, p->tm_sec);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double get_throttleval( void )
|
float get_long_min( void )
|
||||||
{
|
{
|
||||||
return controls.get_throttle( 0 ); // Hack limiting to one engine
|
// FGState *f;
|
||||||
}
|
double a, d;
|
||||||
|
|
||||||
double get_aileronval( void )
|
// current_aircraft.fdm_state
|
||||||
{
|
|
||||||
return controls.get_aileron();
|
a = current_aircraft.fdm_state->get_Longitude() * RAD_TO_DEG;
|
||||||
}
|
if (a < 0.0) {
|
||||||
|
a = -a;
|
||||||
double get_elevatorval( void )
|
|
||||||
{
|
|
||||||
return controls.get_elevator();
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_elev_trimval( void )
|
|
||||||
{
|
|
||||||
return controls.get_elevator_trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_rudderval( void )
|
|
||||||
{
|
|
||||||
return controls.get_rudder();
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_speed( void )
|
|
||||||
{
|
|
||||||
return( current_aircraft.fdm_state->get_V_equiv_kts() );
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_aoa( void )
|
|
||||||
{
|
|
||||||
return( current_aircraft.fdm_state->get_Alpha() * RAD_TO_DEG );
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_roll( void )
|
|
||||||
{
|
|
||||||
return( current_aircraft.fdm_state->get_Phi() );
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_pitch( void )
|
|
||||||
{
|
|
||||||
return( current_aircraft.fdm_state->get_Theta() );
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_heading( void )
|
|
||||||
{
|
|
||||||
return( current_aircraft.fdm_state->get_Psi() * RAD_TO_DEG );
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_altitude( void )
|
|
||||||
{
|
|
||||||
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
|
|
||||||
return current_aircraft.fdm_state->get_Altitude();
|
|
||||||
} else {
|
|
||||||
return current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER;
|
|
||||||
}
|
}
|
||||||
|
d = (double) ( (int) a);
|
||||||
|
float lon_min = (a - d) * 60.0;
|
||||||
|
return(lon_min);
|
||||||
}
|
}
|
||||||
|
|
||||||
double get_agl( void )
|
float get_throttleval( void )
|
||||||
{
|
{
|
||||||
|
float throttle = controls.get_throttle( 0 );
|
||||||
|
return (throttle); // Hack limiting to one engine
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_aileronval( void )
|
||||||
|
{
|
||||||
|
float aileronval = controls.get_aileron();
|
||||||
|
return (aileronval);
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_elevatorval( void )
|
||||||
|
{
|
||||||
|
float elevator_val = (float)controls.get_elevator();
|
||||||
|
return elevator_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_elev_trimval( void )
|
||||||
|
{
|
||||||
|
float elevatorval = controls.get_elevator_trim();
|
||||||
|
return (elevatorval);
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_rudderval( void )
|
||||||
|
{
|
||||||
|
float rudderval = controls.get_rudder();
|
||||||
|
return (rudderval);
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_speed( void )
|
||||||
|
{
|
||||||
|
// Make an explicit function call.
|
||||||
|
float speed = current_aircraft.fdm_state->get_V_equiv_kts();
|
||||||
|
return( speed );
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_aoa( void )
|
||||||
|
{
|
||||||
|
float aoa = current_aircraft.fdm_state->get_Alpha() * RAD_TO_DEG;
|
||||||
|
return( aoa );
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_roll( void )
|
||||||
|
{
|
||||||
|
float roll = current_aircraft.fdm_state->get_Phi();
|
||||||
|
return( roll );
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_pitch( void )
|
||||||
|
{
|
||||||
|
float pitch = current_aircraft.fdm_state->get_Theta();
|
||||||
|
return( pitch );
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_heading( void )
|
||||||
|
{
|
||||||
|
float heading = (current_aircraft.fdm_state->get_Psi() * RAD_TO_DEG);
|
||||||
|
return( heading );
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_altitude( void )
|
||||||
|
{
|
||||||
|
// FGState *f;
|
||||||
|
// double rough_elev;
|
||||||
|
|
||||||
|
// current_aircraft.fdm_state
|
||||||
|
// rough_elev = mesh_altitude(f->get_Longitude() * RAD_TO_ARCSEC,
|
||||||
|
// f->get_Latitude() * RAD_TO_ARCSEC);
|
||||||
|
float altitude;
|
||||||
|
|
||||||
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
|
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
|
||||||
return current_aircraft.fdm_state->get_Altitude()
|
altitude = current_aircraft.fdm_state->get_Altitude();
|
||||||
- scenery.cur_elev * METER_TO_FEET;
|
|
||||||
} else {
|
} else {
|
||||||
return current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER
|
altitude = (current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER);
|
||||||
- scenery.cur_elev;
|
|
||||||
}
|
}
|
||||||
|
return altitude;
|
||||||
}
|
}
|
||||||
|
|
||||||
double get_sideslip( void )
|
float get_agl( void )
|
||||||
{
|
{
|
||||||
return( current_aircraft.fdm_state->get_Beta() );
|
// FGState *f;
|
||||||
}
|
|
||||||
|
|
||||||
double get_frame_rate( void )
|
// f = current_aircraft.fdm_state;
|
||||||
{
|
|
||||||
return (double) general.get_frame_rate();
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_fov( void )
|
float agl;
|
||||||
{
|
|
||||||
return (current_options.get_fov());
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_vfc_ratio( void )
|
|
||||||
{
|
|
||||||
return current_view.get_vfc_ratio();
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_vfc_tris_drawn ( void )
|
|
||||||
{
|
|
||||||
return current_view.get_tris_rendered();
|
|
||||||
}
|
|
||||||
|
|
||||||
double get_climb_rate( void )
|
|
||||||
{
|
|
||||||
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
|
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
|
||||||
return current_aircraft.fdm_state->get_Climb_Rate() * 60.0;
|
agl = (current_aircraft.fdm_state->get_Altitude()
|
||||||
|
- scenery.cur_elev * METER_TO_FEET);
|
||||||
} else {
|
} else {
|
||||||
return current_aircraft.fdm_state->get_Climb_Rate()
|
agl = (current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER
|
||||||
* FEET_TO_METER * 60.0;
|
- scenery.cur_elev);
|
||||||
}
|
}
|
||||||
|
return agl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float get_sideslip( void )
|
||||||
|
{
|
||||||
|
// FGState *f;
|
||||||
|
|
||||||
|
// f = current_aircraft.fdm_state;
|
||||||
|
float sideslip = current_aircraft.fdm_state->get_Beta();
|
||||||
|
|
||||||
|
return( sideslip );
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_frame_rate( void )
|
||||||
|
{
|
||||||
|
float frame_rate = general.get_frame_rate();
|
||||||
|
return (frame_rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_fov( void )
|
||||||
|
{
|
||||||
|
float fov = current_options.get_fov();
|
||||||
|
return (fov);
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_vfc_ratio( void )
|
||||||
|
{
|
||||||
|
float vfc = current_view.get_vfc_ratio();
|
||||||
|
return (vfc);
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_vfc_tris_drawn ( void )
|
||||||
|
{
|
||||||
|
float rendered = current_view.get_tris_rendered();
|
||||||
|
return (rendered);
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_vfc_tris_culled ( void )
|
||||||
|
{
|
||||||
|
float culled = current_view.get_tris_culled();
|
||||||
|
return (culled);
|
||||||
|
}
|
||||||
|
|
||||||
|
float get_climb_rate( void )
|
||||||
|
{
|
||||||
|
// FGState *f;
|
||||||
|
|
||||||
|
// current_aircraft.fdm_state
|
||||||
|
|
||||||
|
float climb_rate;
|
||||||
|
if ( current_options.get_units() == fgOPTIONS::FG_UNITS_FEET ) {
|
||||||
|
climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * 60.0;
|
||||||
|
} else {
|
||||||
|
climb_rate = current_aircraft.fdm_state->get_Climb_Rate() * FEET_TO_METER * 60.0;
|
||||||
|
}
|
||||||
|
return (climb_rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float get_view_direction( void )
|
||||||
|
{
|
||||||
|
// FGState *f;
|
||||||
|
|
||||||
|
|
||||||
|
// FGView *pview;
|
||||||
|
double view;
|
||||||
|
|
||||||
|
// pview = ¤t_view;
|
||||||
|
// current_aircraft.fdm_state
|
||||||
|
|
||||||
|
view = FG_2PI - current_view.get_view_offset();
|
||||||
|
|
||||||
|
view = ( current_aircraft.fdm_state->get_Psi() + view) * RAD_TO_DEG;
|
||||||
|
if(view > 360.)
|
||||||
|
view -= 360.;
|
||||||
|
else if(view<0.)
|
||||||
|
view += 360.;
|
||||||
|
float fview = view;
|
||||||
|
return( fview );
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef NOT_USED
|
||||||
|
/****************************************************************************/
|
||||||
|
/* Convert degrees to dd mm'ss.s" (DMS-Format) */
|
||||||
|
/****************************************************************************/
|
||||||
|
char *dmshh_format(double degrees)
|
||||||
|
{
|
||||||
|
static char buf[16];
|
||||||
|
int deg_part;
|
||||||
|
int min_part;
|
||||||
|
double sec_part;
|
||||||
|
|
||||||
|
if (degrees < 0)
|
||||||
|
degrees = -degrees;
|
||||||
|
|
||||||
|
deg_part = degrees;
|
||||||
|
min_part = 60.0 * (degrees - deg_part);
|
||||||
|
sec_part = 3600.0 * (degrees - deg_part - min_part / 60.0);
|
||||||
|
|
||||||
|
/* Round off hundredths */
|
||||||
|
if (sec_part + 0.005 >= 60.0)
|
||||||
|
sec_part -= 60.0, min_part += 1;
|
||||||
|
if (min_part >= 60)
|
||||||
|
min_part -= 60, deg_part += 1;
|
||||||
|
|
||||||
|
sprintf(buf,"%02d*%02d\'%05.2f\"",deg_part,min_part,sec_part);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
/* Convert degrees to dd mm'ss.s'' (DMS-Format) */
|
||||||
|
/****************************************************************************/
|
||||||
|
static char *toDMS(float a)
|
||||||
|
{
|
||||||
|
int neg = 0;
|
||||||
|
float d, m, s;
|
||||||
|
static char dms[16];
|
||||||
|
|
||||||
|
if (a < 0.0f) {
|
||||||
|
a = -a;
|
||||||
|
neg = 1;
|
||||||
|
}
|
||||||
|
d = (float) ((int) a);
|
||||||
|
a = (a - d) * 60.0f;
|
||||||
|
m = (float) ((int) a);
|
||||||
|
s = (a - m) * 60.0f;
|
||||||
|
|
||||||
|
if (s > 59.5f) {
|
||||||
|
s = 0.0f;
|
||||||
|
m += 1.0f;
|
||||||
|
}
|
||||||
|
if (m > 59.5f) {
|
||||||
|
m = 0.0f;
|
||||||
|
d += 1.0f;
|
||||||
|
}
|
||||||
|
if (neg)
|
||||||
|
d = -d;
|
||||||
|
|
||||||
|
sprintf(dms, "%.0f*%02.0f'%04.1f\"", d, m, s);
|
||||||
|
return dms;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
/* Convert degrees to dd mm.mmm' (DMM-Format) */
|
||||||
|
/****************************************************************************/
|
||||||
|
static char *toDM(float a)
|
||||||
|
{
|
||||||
|
int neg = 0;
|
||||||
|
float d, m;
|
||||||
|
static char dm[16];
|
||||||
|
|
||||||
|
if (a < 0.0f) {
|
||||||
|
a = -a;
|
||||||
|
neg = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
d = (float) ( (int) a);
|
||||||
|
m = (a - d) * 60.0f;
|
||||||
|
|
||||||
|
if (m > 59.5f) {
|
||||||
|
m = 0.0f;
|
||||||
|
d += 1.0f;
|
||||||
|
}
|
||||||
|
if (neg) d = -d;
|
||||||
|
|
||||||
|
sprintf(dm, "%.0f*%06.3f'", d, m);
|
||||||
|
return dm;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *(*fgLatLonFormat)(float);
|
||||||
|
|
||||||
|
char *coord_format_lat(float latitude)
|
||||||
|
{
|
||||||
|
static char buf[16];
|
||||||
|
|
||||||
|
sprintf(buf,"%s%c",
|
||||||
|
// dmshh_format(latitude),
|
||||||
|
// toDMS(latitude),
|
||||||
|
// toDM(latitude),
|
||||||
|
fgLatLonFormat(latitude),
|
||||||
|
latitude > 0 ? 'N' : 'S');
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *coord_format_lon(float longitude)
|
||||||
|
{
|
||||||
|
static char buf[80];
|
||||||
|
|
||||||
|
sprintf(buf,"%s%c",
|
||||||
|
// dmshh_format(longitude),
|
||||||
|
// toDMS(longitude),
|
||||||
|
// toDM(longitude),
|
||||||
|
fgLatLonFormat(longitude),
|
||||||
|
longitude > 0 ? 'E' : 'W');
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void fgLatLonFormatToggle( puObject *)
|
||||||
|
{
|
||||||
|
static int toggle = 0;
|
||||||
|
|
||||||
|
if ( toggle )
|
||||||
|
fgLatLonFormat = toDM;
|
||||||
|
else
|
||||||
|
fgLatLonFormat = toDMS;
|
||||||
|
|
||||||
|
toggle = ~toggle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef NOT_USED
|
||||||
|
char *coord_format_latlon(double latitude, double longitude)
|
||||||
|
{
|
||||||
|
static char buf[1024];
|
||||||
|
|
||||||
|
sprintf(buf,"%s%c %s%c",
|
||||||
|
dmshh_format(latitude),
|
||||||
|
latitude > 0 ? 'N' : 'S',
|
||||||
|
dmshh_format(longitude),
|
||||||
|
longitude > 0 ? 'E' : 'W');
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef FAST_TEXT_TEST
|
||||||
|
#undef FAST_TEXT_TEST
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef FAST_TEXT_TEST
|
||||||
|
|
||||||
|
static unsigned int first=0, last=128;
|
||||||
|
unsigned int font_base;
|
||||||
|
|
||||||
|
#define FONT "-adobe-courier-medium-r-normal--24-240-75-75-m-150-iso8859-1"
|
||||||
|
HFONT hFont;
|
||||||
|
|
||||||
|
void Font_Setup(void)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
int count;
|
||||||
|
HDC hdc;
|
||||||
|
HGLRC hglrc;
|
||||||
|
|
||||||
|
|
||||||
|
hdc = wglGetCurrentDC();
|
||||||
|
hglrc = wglGetCurrentContext();
|
||||||
|
|
||||||
|
if (hdc == 0 || hglrc == 0) {
|
||||||
|
printf("Could not get context or DC\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!wglMakeCurrent(hdc, hglrc)) {
|
||||||
|
printf("Could not make context current\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define FONTBASE 0x1000
|
||||||
|
/*
|
||||||
|
hFont = GetStockObject(SYSTEM_FONT);
|
||||||
|
hFont = CreateFont(h, w, esc, orient, weight,
|
||||||
|
ital, under, strike, set, out, clip, qual, pitch/fam, face);
|
||||||
|
*/
|
||||||
|
hFont = CreateFont(30, 0, 0, 0, FW_NORMAL,
|
||||||
|
FALSE, FALSE, FALSE, ANSI_CHARSET,
|
||||||
|
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DRAFT_QUALITY,
|
||||||
|
FIXED_PITCH | FF_MODERN, "Arial");
|
||||||
|
if (!hFont) {
|
||||||
|
MessageBox(WindowFromDC(hdc),
|
||||||
|
"Failed to find acceptable bitmap font.",
|
||||||
|
"OpenGL Application Error",
|
||||||
|
MB_ICONERROR | MB_OK);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
(void) SelectObject(hdc, hFont);
|
||||||
|
wglUseFontBitmaps(hdc, 0, 255, FONTBASE);
|
||||||
|
glListBase(FONTBASE);
|
||||||
|
#if 0
|
||||||
|
SelectObject (hdc, GetStockObject (SYSTEM_FONT));
|
||||||
|
|
||||||
|
count=last-first+1;
|
||||||
|
font_base = glGenLists(count);
|
||||||
|
wglUseFontBitmaps (hdc, first, last, font_base);
|
||||||
|
if (font_base == 0) {
|
||||||
|
printf("Could not generate Text_Setup list\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
#endif // 0
|
||||||
|
#else
|
||||||
|
Display *Dpy;
|
||||||
|
XFontStruct *fontInfo;
|
||||||
|
Font id;
|
||||||
|
|
||||||
|
Dpy = XOpenDisplay(NULL);
|
||||||
|
fontInfo = XLoadQueryFont(Dpy, FONT);
|
||||||
|
if (fontInfo == NULL)
|
||||||
|
{
|
||||||
|
printf("Failed to load font %s\n", FONT);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
id = fontInfo->fid;
|
||||||
|
first = fontInfo->min_char_or_byte2;
|
||||||
|
last = fontInfo->max_char_or_byte2;
|
||||||
|
|
||||||
|
base = glGenLists((GLuint) last+1);
|
||||||
|
if (base == 0) {
|
||||||
|
printf ("out of display lists\n");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
glXUseXFont(id, first, last-first+1, base+first);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
drawString(char *string, GLfloat x, GLfloat y, GLfloat color[4])
|
||||||
|
{
|
||||||
|
glColor4fv(color);
|
||||||
|
glRasterPos2f(x, y);
|
||||||
|
glCallLists(strlen(string), GL_BYTE, (GLbyte *) string);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // #ifdef FAST_TEXT_TEST
|
||||||
|
|
||||||
bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
|
bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
|
||||||
{
|
{
|
||||||
FG_LOG( FG_COCKPIT, FG_INFO, "Initializing cockpit subsystem" );
|
FG_LOG( FG_COCKPIT, FG_INFO, "Initializing cockpit subsystem" );
|
||||||
|
|
||||||
// cockpit->code = 1; /* It will be aircraft dependent */
|
// cockpit->code = 1; /* It will be aircraft dependent */
|
||||||
// cockpit->status = 0;
|
// cockpit->status = 0;
|
||||||
|
|
||||||
// If aircraft has HUD specified we will get the specs from its def
|
// If aircraft has HUD specified we will get the specs from its def
|
||||||
// file. For now we will depend upon hard coding in hud?
|
// file. For now we will depend upon hard coding in hud?
|
||||||
|
@ -233,6 +589,10 @@ bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
|
||||||
// HI_Head is now a null pointer so we can generate a new list from the
|
// HI_Head is now a null pointer so we can generate a new list from the
|
||||||
// current aircraft.
|
// current aircraft.
|
||||||
|
|
||||||
|
#ifdef FAST_TEXT_TEST
|
||||||
|
Font_Setup();
|
||||||
|
#endif // #ifdef FAST_TEXT_TEST
|
||||||
|
|
||||||
fgHUDInit( cur_aircraft );
|
fgHUDInit( cur_aircraft );
|
||||||
ac_cockpit = new fg_Cockpit();
|
ac_cockpit = new fg_Cockpit();
|
||||||
|
|
||||||
|
@ -240,33 +600,101 @@ bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
|
||||||
new FGPanel;
|
new FGPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Have to set the LatLon display type
|
||||||
|
fgLatLonFormat = toDM;
|
||||||
|
|
||||||
FG_LOG( FG_COCKPIT, FG_INFO,
|
FG_LOG( FG_COCKPIT, FG_INFO,
|
||||||
" Code " << ac_cockpit->code() << " Status "
|
" Code " << ac_cockpit->code() << " Status "
|
||||||
<< ac_cockpit->status() );
|
<< ac_cockpit->status() );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void fgCockpitUpdate( void ) {
|
void fgCockpitUpdate( void ) {
|
||||||
|
|
||||||
|
#define DISPLAY_COUNTER
|
||||||
|
#ifdef DISPLAY_COUNTER
|
||||||
|
static float lightCheck[4] = { 0.7F, 0.7F, 0.7F, 1.0F };
|
||||||
|
char buf[64],*ptr;
|
||||||
|
// int fontSize;
|
||||||
|
int c;
|
||||||
|
#endif
|
||||||
|
|
||||||
FG_LOG( FG_COCKPIT, FG_DEBUG,
|
FG_LOG( FG_COCKPIT, FG_DEBUG,
|
||||||
"Cockpit: code " << ac_cockpit->code() << " status "
|
"Cockpit: code " << ac_cockpit->code() << " status "
|
||||||
<< ac_cockpit->status() );
|
<< ac_cockpit->status() );
|
||||||
|
|
||||||
if ( current_options.get_hud_status() ) {
|
if ( current_options.get_hud_status() ) {
|
||||||
// This will check the global hud linked list pointer.
|
// This will check the global hud linked list pointer.
|
||||||
// If these is anything to draw it will.
|
// If these is anything to draw it will.
|
||||||
fgUpdateHUD();
|
fgUpdateHUD();
|
||||||
}
|
}
|
||||||
|
#ifdef DISPLAY_COUNTER
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float fps = get_frame_rate();
|
||||||
|
float tris = fps * get_vfc_tris_drawn();
|
||||||
|
float culled = fps * get_vfc_tris_culled();
|
||||||
|
|
||||||
|
int len = sprintf(buf," %4.1f %7.0f %7.0f",
|
||||||
|
fps, tris, culled);
|
||||||
|
// sprintf(buf,"Tris Per Sec: %7.0f", t);
|
||||||
|
// fontSize = (current_options.get_xsize() > 1000) ? LARGE : SMALL;
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
|
||||||
|
glLoadIdentity();
|
||||||
|
gluOrtho2D(0, 1024, 0, 768);
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
|
|
||||||
|
// glColor3f (.90, 0.27, 0.67);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef FAST_TEXT_TEST
|
||||||
|
drawString(buf, 250.0F, 10.0F, lightCheck);
|
||||||
|
// glRasterPos2f( 220, 10);
|
||||||
|
// for (int i=0; i < len; i++) {
|
||||||
|
// glCallList(font_base+buf[i]);
|
||||||
|
// }
|
||||||
|
#else
|
||||||
|
glColor3f (.8, 0.8, 0.8);
|
||||||
|
glTranslatef( 400, 10, 0);
|
||||||
|
glScalef(.1, .1, 0.0);
|
||||||
|
ptr = buf;
|
||||||
|
while ( ( c = *ptr++) ){
|
||||||
|
glutStrokeCharacter( GLUT_STROKE_MONO_ROMAN, c);
|
||||||
|
}
|
||||||
|
#endif // #ifdef FAST_TEXT_TEST
|
||||||
|
|
||||||
|
// glutStrokeCharacter( GLUT_STROKE_MONO_ROMAN, ' ');
|
||||||
|
// glutStrokeCharacter( GLUT_STROKE_MONO_ROMAN, ' ');
|
||||||
|
|
||||||
|
// ptr = get_formated_gmt_time();
|
||||||
|
// while ( ( c = *ptr++) ){
|
||||||
|
// glutStrokeCharacter( GLUT_STROKE_MONO_ROMAN, c);
|
||||||
|
// }
|
||||||
|
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glEnable(GL_LIGHTING);
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPopMatrix();
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPopMatrix();
|
||||||
|
}
|
||||||
|
#endif // DISPLAY_COUNTER
|
||||||
|
|
||||||
if ( current_options.get_panel_status() &&
|
if ( current_options.get_panel_status() &&
|
||||||
(fabs( current_view.get_view_offset() ) < 0.2) )
|
(fabs( current_view.get_view_offset() ) < 0.2) )
|
||||||
{
|
{
|
||||||
xglViewport( 0, 0,
|
xglViewport( 0, 0,
|
||||||
current_view.get_winWidth(),
|
current_view.get_winWidth(),
|
||||||
current_view.get_winHeight() );
|
current_view.get_winHeight() );
|
||||||
FGPanel::OurPanel->Update();
|
FGPanel::OurPanel->Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,26 @@
|
||||||
// cockpit.hxx -- cockpit defines and prototypes (initial draft)
|
/**************************************************************************
|
||||||
//
|
* cockpit.hxx -- cockpit defines and prototypes (initial draft)
|
||||||
// Written by Michele America, started September 1997.
|
*
|
||||||
//
|
* Written by Michele America, started September 1997.
|
||||||
// Copyright (C) 1997 Michele F. America - nomimarketing@mail.telepac.pt
|
*
|
||||||
//
|
* Copyright (C) 1997 Michele F. America - nomimarketing@mail.telepac.pt
|
||||||
// This program is free software; you can redistribute it and/or
|
*
|
||||||
// modify it under the terms of the GNU General Public License as
|
* This program is free software; you can redistribute it and/or
|
||||||
// published by the Free Software Foundation; either version 2 of the
|
* modify it under the terms of the GNU General Public License as
|
||||||
// License, or (at your option) any later version.
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
//
|
* License, or (at your option) any later version.
|
||||||
// This program is distributed in the hope that it will be useful, but
|
*
|
||||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
* This program is distributed in the hope that it will be useful, but
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// General Public License for more details.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
//
|
* General Public License for more details.
|
||||||
// You should have received a copy of the GNU General Public License
|
*
|
||||||
// along with this program; if not, write to the Free Software
|
* You should have received a copy of the GNU General Public License
|
||||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* along with this program; if not, write to the Free Software
|
||||||
//
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
// $Id$
|
*
|
||||||
|
* $Id$
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _COCKPIT_HXX
|
#ifndef _COCKPIT_HXX
|
||||||
|
@ -34,7 +36,7 @@
|
||||||
#include "panel.hxx"
|
#include "panel.hxx"
|
||||||
|
|
||||||
// Class fg_Cockpit This class is a holder for the heads up display
|
// Class fg_Cockpit This class is a holder for the heads up display
|
||||||
// and is initialized with a
|
// and is initialized with a
|
||||||
class fg_Cockpit {
|
class fg_Cockpit {
|
||||||
private:
|
private:
|
||||||
int Code;
|
int Code;
|
||||||
|
@ -53,6 +55,4 @@ bool fgCockpitInit( fgAIRCRAFT *cur_aircraft );
|
||||||
void fgCockpitUpdate( void );
|
void fgCockpitUpdate( void );
|
||||||
|
|
||||||
|
|
||||||
#endif // _COCKPIT_HXX
|
#endif /* _COCKPIT_HXX */
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -44,8 +44,8 @@
|
||||||
# include <values.h> // for MAXINT
|
# include <values.h> // for MAXINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <deque> // STL double ended queue
|
|
||||||
#include <vector> // STL vector
|
#include <vector> // STL vector
|
||||||
|
#include <deque> // STL double ended queue
|
||||||
|
|
||||||
#include <fg_typedefs.h>
|
#include <fg_typedefs.h>
|
||||||
#include <fg_constants.h>
|
#include <fg_constants.h>
|
||||||
|
@ -53,6 +53,10 @@
|
||||||
#include <FDM/flight.hxx>
|
#include <FDM/flight.hxx>
|
||||||
#include <Controls/controls.hxx>
|
#include <Controls/controls.hxx>
|
||||||
|
|
||||||
|
//#include "glfont.h"
|
||||||
|
|
||||||
|
//extern GLFONT *myFont;
|
||||||
|
|
||||||
FG_USING_STD(deque);
|
FG_USING_STD(deque);
|
||||||
FG_USING_STD(vector);
|
FG_USING_STD(vector);
|
||||||
|
|
||||||
|
@ -107,10 +111,10 @@ enum fgLabelJust{ LEFT_JUST, CENTER_JUST, RIGHT_JUST } ;
|
||||||
#define DASHED_NEG_LINES 12
|
#define DASHED_NEG_LINES 12
|
||||||
|
|
||||||
|
|
||||||
#define HORIZON_FIXED 1
|
#define HORIZON_FIXED 1
|
||||||
#define HORIZON_MOVING 2
|
#define HORIZON_MOVING 2
|
||||||
#define LABEL_COUNTER 1
|
#define LABEL_COUNTER 1
|
||||||
#define LABEL_WARNING 2
|
#define LABEL_WARNING 2
|
||||||
|
|
||||||
#define HUDS_AUTOTICKS 0x0001
|
#define HUDS_AUTOTICKS 0x0001
|
||||||
#define HUDS_VERT 0x0002
|
#define HUDS_VERT 0x0002
|
||||||
|
@ -127,52 +131,60 @@ enum fgLabelJust{ LEFT_JUST, CENTER_JUST, RIGHT_JUST } ;
|
||||||
|
|
||||||
// Ladder orientaion
|
// Ladder orientaion
|
||||||
// #define HUD_VERTICAL 1
|
// #define HUD_VERTICAL 1
|
||||||
// #define HUD_HORIZONTAL 2
|
// #define HUD_HORIZONTAL 2
|
||||||
// #define HUD_FREEFLOAT 3
|
// #define HUD_FREEFLOAT 3
|
||||||
|
|
||||||
// Ladder orientation modes
|
// Ladder orientation modes
|
||||||
// #define HUD_LEFT 1
|
// #define HUD_LEFT 1
|
||||||
// #define HUD_RIGHT 2
|
// #define HUD_RIGHT 2
|
||||||
// #define HUD_TOP 1
|
// #define HUD_TOP 1
|
||||||
// #define HUD_BOTTOM 2
|
// #define HUD_BOTTOM 2
|
||||||
// #define HUD_V_LEFT 1
|
// #define HUD_V_LEFT 1
|
||||||
// #define HUD_V_RIGHT 2
|
// #define HUD_V_RIGHT 2
|
||||||
// #define HUD_H_TOP 1
|
// #define HUD_H_TOP 1
|
||||||
// #define HUD_H_BOTTOM 2
|
// #define HUD_H_BOTTOM 2
|
||||||
|
|
||||||
|
|
||||||
// Ladder sub-types
|
// Ladder sub-types
|
||||||
// #define HUD_LIM 1
|
// #define HUD_LIM 1
|
||||||
// #define HUD_NOLIM 2
|
// #define HUD_NOLIM 2
|
||||||
// #define HUD_CIRC 3
|
// #define HUD_CIRC 3
|
||||||
|
|
||||||
// #define HUD_INSTR_LADDER 1
|
// #define HUD_INSTR_LADDER 1
|
||||||
// #define HUD_INSTR_CLADDER 2
|
// #define HUD_INSTR_CLADDER 2
|
||||||
// #define HUD_INSTR_HORIZON 3
|
// #define HUD_INSTR_HORIZON 3
|
||||||
// #define HUD_INSTR_LABEL 4
|
// #define HUD_INSTR_LABEL 4
|
||||||
|
|
||||||
extern double get_throttleval ( void );
|
// in cockpit.cxx
|
||||||
extern double get_aileronval ( void );
|
extern float get_throttleval ( void );
|
||||||
extern double get_elevatorval ( void );
|
extern float get_aileronval ( void );
|
||||||
extern double get_elev_trimval( void );
|
extern float get_elevatorval ( void );
|
||||||
extern double get_rudderval ( void );
|
extern float get_elev_trimval( void );
|
||||||
extern double get_speed ( void );
|
extern float get_rudderval ( void );
|
||||||
extern double get_aoa ( void );
|
extern float get_speed ( void );
|
||||||
extern double get_roll ( void );
|
extern float get_aoa ( void );
|
||||||
extern double get_pitch ( void );
|
extern float get_roll ( void );
|
||||||
extern double get_heading ( void );
|
extern float get_pitch ( void );
|
||||||
extern double get_altitude ( void );
|
extern float get_heading ( void );
|
||||||
extern double get_agl ( void );
|
extern float get_view_direction( void );
|
||||||
extern double get_sideslip ( void );
|
extern float get_altitude ( void );
|
||||||
extern double get_frame_rate ( void );
|
extern float get_agl ( void );
|
||||||
extern double get_latitude ( void );
|
extern float get_sideslip ( void );
|
||||||
extern double get_lat_min ( void );
|
extern float get_frame_rate ( void );
|
||||||
extern double get_longitude ( void );
|
extern float get_latitude ( void );
|
||||||
extern double get_long_min ( void );
|
extern float get_lat_min ( void );
|
||||||
extern double get_fov ( void );
|
extern float get_longitude ( void );
|
||||||
extern double get_vfc_ratio ( void );
|
extern float get_long_min ( void );
|
||||||
extern double get_vfc_tris_drawn ( void );
|
extern float get_fov ( void );
|
||||||
extern double get_climb_rate ( void );
|
extern float get_vfc_ratio ( void );
|
||||||
|
extern float get_vfc_tris_drawn ( void );
|
||||||
|
extern float get_vfc_tris_culled ( void );
|
||||||
|
extern float get_climb_rate ( void );
|
||||||
|
extern char *coord_format_lat(float);
|
||||||
|
extern char *coord_format_lon(float);
|
||||||
|
//extern char *coord_format_latlon(float latitude, float longitude); // cockpit.cxx
|
||||||
|
|
||||||
|
extern char *get_formated_gmt_time( void );
|
||||||
|
|
||||||
enum hudinstype{ HUDno_instr,
|
enum hudinstype{ HUDno_instr,
|
||||||
HUDscale,
|
HUDscale,
|
||||||
|
@ -191,6 +203,131 @@ typedef struct gltagRGBTRIPLE { // rgbt
|
||||||
GLfloat Green;
|
GLfloat Green;
|
||||||
GLfloat Red;
|
GLfloat Red;
|
||||||
} glRGBTRIPLE;
|
} glRGBTRIPLE;
|
||||||
|
/*
|
||||||
|
struct fgVertex2D {
|
||||||
|
UINT x, y;
|
||||||
|
|
||||||
|
fgVertex2D( UINT a = 0, UINT b =0 )
|
||||||
|
: x(a), y(b) {}
|
||||||
|
|
||||||
|
fgVertex2D( const fgVertex2D & image )
|
||||||
|
: x(image.x), y(image.y) {}
|
||||||
|
|
||||||
|
fgVertex2D& operator= ( const fgVertex2D & image ) {
|
||||||
|
x = image.x; y = image.y; return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
~fgVertex2D() {}
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
class fgLineSeg2D {
|
||||||
|
private:
|
||||||
|
GLfloat x0, y0, x1, y1; //UINT
|
||||||
|
|
||||||
|
public:
|
||||||
|
fgLineSeg2D( GLfloat a = 0, GLfloat b =0, GLfloat c = 0, GLfloat d =0 )
|
||||||
|
: x0(a), y0(b), x1(c), y1(d) {}
|
||||||
|
|
||||||
|
fgLineSeg2D( const fgLineSeg2D & image )
|
||||||
|
: x0(image.x0), y0(image.y0), x1(image.x1), y1(image.y1) {}
|
||||||
|
|
||||||
|
fgLineSeg2D& operator= ( const fgLineSeg2D & image ) {
|
||||||
|
x0 = image.x0; y0 = image.y0; x1 = image.x1; y1 = image.y1; return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
~fgLineSeg2D() {}
|
||||||
|
|
||||||
|
void draw()
|
||||||
|
{
|
||||||
|
glVertex2f(x0, y0);
|
||||||
|
glVertex2f(x1, y1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#define USE_HUD_TextList
|
||||||
|
#ifdef USE_HUD_TextList
|
||||||
|
|
||||||
|
//#define FAST_TEXT_TEST
|
||||||
|
#ifdef FAST_TEXT_TEST
|
||||||
|
extern void Font_Setup(void);
|
||||||
|
extern unsigned int font_base;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class fgTextString {
|
||||||
|
private:
|
||||||
|
void *font;
|
||||||
|
char msg[80];
|
||||||
|
float x, y;
|
||||||
|
// static GLfloat mat[16];
|
||||||
|
|
||||||
|
public:
|
||||||
|
fgTextString( void *d = NULL, char *c = NULL, UINT x = 0, UINT y =0 )
|
||||||
|
: font(d), x(x), y(y) {strcpy(msg,c);}
|
||||||
|
|
||||||
|
fgTextString( const fgTextString & image )
|
||||||
|
: font(image.font), x(image.x), y(image.y) {strcpy(msg,image.msg);}
|
||||||
|
|
||||||
|
fgTextString& operator = ( const fgTextString & image ) {
|
||||||
|
font = image.font; strcpy(msg,image.msg); x = image.x; y = image.y;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
~fgTextString() {msg[0]='\0';}
|
||||||
|
|
||||||
|
// void set_mat(void) {
|
||||||
|
// glScalef(.075, .075, 0.0);
|
||||||
|
// glGetFloatv(GL_MODELVIEW_MATRIX, mat);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
void draw()
|
||||||
|
{
|
||||||
|
#ifdef FAST_TEXT_TEST
|
||||||
|
glRasterPos2f( x, y);
|
||||||
|
int len = (int) strlen(msg);
|
||||||
|
for (int i=0; i < len; i++) {
|
||||||
|
glCallList(font_base+msg[i]);
|
||||||
|
}
|
||||||
|
// glFontTextOut ( msg, x, y, 0.0f);
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define USE_STROKED_CHAR
|
||||||
|
#ifdef USE_STROKED_CHAR
|
||||||
|
int c;
|
||||||
|
char *buf;
|
||||||
|
buf = msg;
|
||||||
|
if(*buf)
|
||||||
|
{
|
||||||
|
// glRasterPos2f( x, y);
|
||||||
|
glTranslatef( x, y, 0);
|
||||||
|
glScalef(.075, .075, 0.0);
|
||||||
|
while ((c=*buf++)) {
|
||||||
|
glutStrokeCharacter( GLUT_STROKE_MONO_ROMAN, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
char *c = msg;
|
||||||
|
if(*c)
|
||||||
|
{
|
||||||
|
glRasterPos2f(x, y);
|
||||||
|
while (*c) {
|
||||||
|
glutBitmapCharacter(font, *c);
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // #ifdef USE_STROKED_CHAR
|
||||||
|
#endif // FAST_TEXT_TEST
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef vector< fgTextString > TYPE_HUD_TextList;
|
||||||
|
extern TYPE_HUD_TextList HUD_TextList;
|
||||||
|
#endif //#ifdef USE_HUD_TextList
|
||||||
|
|
||||||
|
|
||||||
|
typedef vector< fgLineSeg2D > TYPE_HUD_LineList;
|
||||||
|
extern TYPE_HUD_LineList HUD_LineList;
|
||||||
|
extern TYPE_HUD_LineList HUD_StippleLineList;
|
||||||
|
|
||||||
class instr_item { // An Abstract Base Class (ABC)
|
class instr_item { // An Abstract Base Class (ABC)
|
||||||
private:
|
private:
|
||||||
|
@ -201,8 +338,8 @@ class instr_item { // An Abstract Base Class (ABC)
|
||||||
UINT handle;
|
UINT handle;
|
||||||
RECT scrn_pos; // Framing - affects scale dimensions
|
RECT scrn_pos; // Framing - affects scale dimensions
|
||||||
// and orientation. Vert vs Horz, etc.
|
// and orientation. Vert vs Horz, etc.
|
||||||
DBLFNPTR load_value_fn;
|
FLTFNPTR load_value_fn;
|
||||||
double disp_factor; // Multiply by to get numbers shown on scale.
|
float disp_factor; // Multiply by to get numbers shown on scale.
|
||||||
UINT opts;
|
UINT opts;
|
||||||
bool is_enabled;
|
bool is_enabled;
|
||||||
bool broken;
|
bool broken;
|
||||||
|
@ -214,8 +351,8 @@ class instr_item { // An Abstract Base Class (ABC)
|
||||||
int y,
|
int y,
|
||||||
UINT height,
|
UINT height,
|
||||||
UINT width,
|
UINT width,
|
||||||
DBLFNPTR data_source,
|
FLTFNPTR data_source,
|
||||||
double data_scaling,
|
float data_scaling,
|
||||||
UINT options,
|
UINT options,
|
||||||
bool working = true);
|
bool working = true);
|
||||||
|
|
||||||
|
@ -229,28 +366,64 @@ class instr_item { // An Abstract Base Class (ABC)
|
||||||
bool is_broken ( void ) { return broken; }
|
bool is_broken ( void ) { return broken; }
|
||||||
bool enabled ( void ) { return is_enabled;}
|
bool enabled ( void ) { return is_enabled;}
|
||||||
bool data_available ( void ) { return !!load_value_fn; }
|
bool data_available ( void ) { return !!load_value_fn; }
|
||||||
double get_value ( void ) { return load_value_fn(); }
|
float get_value ( void ) { return load_value_fn(); }
|
||||||
double data_scaling ( void ) { return disp_factor; }
|
float data_scaling ( void ) { return disp_factor; }
|
||||||
UINT get_span ( void ) { return scr_span; }
|
UINT get_span ( void ) { return scr_span; }
|
||||||
POINT get_centroid ( void ) { return mid_span; }
|
POINT get_centroid ( void ) { return mid_span; }
|
||||||
UINT get_options ( void ) { return opts; }
|
UINT get_options ( void ) { return opts; }
|
||||||
|
|
||||||
|
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_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 ); }
|
||||||
|
UINT huds_bottom (UINT options) { return( options & HUDS_BOTTOM ); }
|
||||||
|
|
||||||
virtual void display_enable( bool working ) { is_enabled = !! working;}
|
virtual void display_enable( bool working ) { is_enabled = !! working;}
|
||||||
|
|
||||||
|
|
||||||
virtual void update( void );
|
virtual void update( void );
|
||||||
virtual void break_display ( bool bad );
|
virtual void break_display ( bool bad );
|
||||||
virtual void SetBrightness( int illumination_level ); // fgHUDSetBright...
|
virtual void SetBrightness( int illumination_level ); // fgHUDSetBright...
|
||||||
void SetPosition ( int x, int y, UINT width, UINT height );
|
void SetPosition ( int x, int y, UINT width, UINT height );
|
||||||
UINT get_Handle( void );
|
UINT get_Handle( void );
|
||||||
virtual void draw( void ) = 0; // Required method in derived classes
|
virtual void draw( void ) = 0; // Required method in derived classes
|
||||||
|
|
||||||
|
void drawOneLine( UINT x1, UINT y1, UINT x2, UINT y2)
|
||||||
|
{
|
||||||
|
HUD_LineList.push_back(fgLineSeg2D(x1,y1,x2,y2));
|
||||||
|
// glBegin(GL_LINES);
|
||||||
|
// glVertex2i(x1, y1);
|
||||||
|
// glVertex2i(x2, y2);
|
||||||
|
// glEnd();
|
||||||
|
}
|
||||||
|
void drawOneStippleLine( UINT x1, UINT y1, UINT x2, UINT y2)
|
||||||
|
{
|
||||||
|
HUD_StippleLineList.push_back(fgLineSeg2D(x1,y1,x2,y2));
|
||||||
|
// glEnable(GL_LINE_STIPPLE);
|
||||||
|
// glLineStipple( 1, 0x00FF );
|
||||||
|
// glBegin(GL_LINES);
|
||||||
|
// glVertex2i(x1, y1);
|
||||||
|
// glVertex2i(x2, y2);
|
||||||
|
// glEnd();
|
||||||
|
// glDisable(GL_LINE_STIPPLE);
|
||||||
|
}
|
||||||
|
#ifdef USE_HUD_TextList
|
||||||
|
void TextString( void *font, char *msg, UINT x, UINT y )
|
||||||
|
{
|
||||||
|
HUD_TextList.push_back(fgTextString(font, msg, x, y));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef deque< instr_item * > HudContainerType;
|
|
||||||
typedef HudContainerType::iterator HudIterator;
|
|
||||||
|
|
||||||
typedef instr_item *HIptr;
|
typedef instr_item *HIptr;
|
||||||
extern HudContainerType HUD_deque;
|
//typedef deque < instr_item * > hud_deque_type;
|
||||||
|
//typedef hud_deque_type::iterator hud_deque_iterator;
|
||||||
|
//typedef hud_deque_type::const_iterator hud_deque_const_iterator;
|
||||||
|
|
||||||
|
extern deque< instr_item *> HUD_deque;
|
||||||
|
//extern hud_deque_type HUD_deque;
|
||||||
|
|
||||||
// instr_item This class has no other purpose than to maintain
|
// instr_item This class has no other purpose than to maintain
|
||||||
// a linked list of instrument and derived class
|
// a linked list of instrument and derived class
|
||||||
|
@ -265,17 +438,18 @@ class instr_label : public instr_item {
|
||||||
fgLabelJust justify;
|
fgLabelJust justify;
|
||||||
int fontSize;
|
int fontSize;
|
||||||
int blink;
|
int blink;
|
||||||
|
char format_buffer[80];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
instr_label( int x,
|
instr_label( int x,
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR data_source,
|
FLTFNPTR data_source,
|
||||||
const char *label_format,
|
const char *label_format,
|
||||||
const char *pre_label_string = 0,
|
const char *pre_label_string = 0,
|
||||||
const char *post_label_string = 0,
|
const char *post_label_string = 0,
|
||||||
double scale_data = 1.0,
|
float scale_data = 1.0,
|
||||||
UINT options = HUDS_TOP,
|
UINT options = HUDS_TOP,
|
||||||
fgLabelJust justification = CENTER_JUST,
|
fgLabelJust justification = CENTER_JUST,
|
||||||
int font_size = SMALL,
|
int font_size = SMALL,
|
||||||
|
@ -291,6 +465,77 @@ class instr_label : public instr_item {
|
||||||
|
|
||||||
typedef instr_label * pInstlabel;
|
typedef instr_label * pInstlabel;
|
||||||
|
|
||||||
|
|
||||||
|
class lat_label : public instr_item {
|
||||||
|
private:
|
||||||
|
const char *pformat;
|
||||||
|
const char *pre_str;
|
||||||
|
const char *post_str;
|
||||||
|
fgLabelJust justify;
|
||||||
|
int fontSize;
|
||||||
|
int blink;
|
||||||
|
char format_buffer[80];
|
||||||
|
|
||||||
|
public:
|
||||||
|
lat_label( int x,
|
||||||
|
int y,
|
||||||
|
UINT width,
|
||||||
|
UINT height,
|
||||||
|
FLTFNPTR data_source,
|
||||||
|
const char *label_format,
|
||||||
|
const char *pre_label_string = 0,
|
||||||
|
const char *post_label_string = 0,
|
||||||
|
float scale_data = 1.0,
|
||||||
|
UINT options = HUDS_TOP,
|
||||||
|
fgLabelJust justification = CENTER_JUST,
|
||||||
|
int font_size = SMALL,
|
||||||
|
int blinking = NOBLINK,
|
||||||
|
bool working = true);
|
||||||
|
|
||||||
|
~lat_label();
|
||||||
|
|
||||||
|
lat_label( const lat_label & image);
|
||||||
|
lat_label & operator = (const lat_label & rhs );
|
||||||
|
virtual void draw( void ); // Required method in base class
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef lat_label * pLatlabel;
|
||||||
|
|
||||||
|
class lon_label : public instr_item {
|
||||||
|
private:
|
||||||
|
const char *pformat;
|
||||||
|
const char *pre_str;
|
||||||
|
const char *post_str;
|
||||||
|
fgLabelJust justify;
|
||||||
|
int fontSize;
|
||||||
|
int blink;
|
||||||
|
char format_buffer[80];
|
||||||
|
|
||||||
|
public:
|
||||||
|
lon_label( int x,
|
||||||
|
int y,
|
||||||
|
UINT width,
|
||||||
|
UINT height,
|
||||||
|
FLTFNPTR data_source,
|
||||||
|
const char *label_format,
|
||||||
|
const char *pre_label_string = 0,
|
||||||
|
const char *post_label_string = 0,
|
||||||
|
float scale_data = 1.0,
|
||||||
|
UINT options = HUDS_TOP,
|
||||||
|
fgLabelJust justification = CENTER_JUST,
|
||||||
|
int font_size = SMALL,
|
||||||
|
int blinking = NOBLINK,
|
||||||
|
bool working = true);
|
||||||
|
|
||||||
|
~lon_label();
|
||||||
|
|
||||||
|
lon_label( const lon_label & image);
|
||||||
|
lon_label & operator = (const lon_label & rhs );
|
||||||
|
virtual void draw( void ); // Required method in base class
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef lon_label * pLonlabel;
|
||||||
|
|
||||||
//
|
//
|
||||||
// instr_scale This class is an abstract base class for both moving
|
// instr_scale This class is an abstract base class for both moving
|
||||||
// scale and moving needle (fixed scale) indicators. It
|
// scale and moving needle (fixed scale) indicators. It
|
||||||
|
@ -299,10 +544,10 @@ typedef instr_label * pInstlabel;
|
||||||
|
|
||||||
class instr_scale : public instr_item {
|
class instr_scale : public instr_item {
|
||||||
private:
|
private:
|
||||||
double range_shown; // Width Units.
|
float range_shown; // Width Units.
|
||||||
double Maximum_value; // ceiling.
|
float Maximum_value; // ceiling.
|
||||||
double Minimum_value; // Representation floor.
|
float Minimum_value; // Representation floor.
|
||||||
double scale_factor; // factor => screen units/range values.
|
float scale_factor; // factor => screen units/range values.
|
||||||
UINT Maj_div; // major division marker units
|
UINT Maj_div; // major division marker units
|
||||||
UINT Min_div; // minor division marker units
|
UINT Min_div; // minor division marker units
|
||||||
UINT Modulo; // Roll over point
|
UINT Modulo; // Roll over point
|
||||||
|
@ -313,12 +558,12 @@ class instr_scale : public instr_item {
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR load_fn,
|
FLTFNPTR load_fn,
|
||||||
UINT options,
|
UINT options,
|
||||||
double show_range,
|
float show_range,
|
||||||
double max_value = 100.0,
|
float max_value = 100.0,
|
||||||
double min_value = 0.0,
|
float min_value = 0.0,
|
||||||
double disp_scaling = 1.0,
|
float disp_scaling = 1.0,
|
||||||
UINT major_divs = 10,
|
UINT major_divs = 10,
|
||||||
UINT minor_divs = 5,
|
UINT minor_divs = 5,
|
||||||
UINT rollover = 0,
|
UINT rollover = 0,
|
||||||
|
@ -332,11 +577,11 @@ class instr_scale : public instr_item {
|
||||||
virtual void draw ( void ) {}; // No-op here. Defined in derived classes.
|
virtual void draw ( void ) {}; // No-op here. Defined in derived classes.
|
||||||
UINT div_min ( void ) { return Min_div;}
|
UINT div_min ( void ) { return Min_div;}
|
||||||
UINT div_max ( void ) { return Maj_div;}
|
UINT div_max ( void ) { return Maj_div;}
|
||||||
double min_val ( void ) { return Minimum_value;}
|
float min_val ( void ) { return Minimum_value;}
|
||||||
double max_val ( void ) { return Maximum_value;}
|
float max_val ( void ) { return Maximum_value;}
|
||||||
UINT modulo ( void ) { return Modulo; }
|
UINT modulo ( void ) { return Modulo; }
|
||||||
double factor ( void ) { return scale_factor;}
|
float factor ( void ) { return scale_factor;}
|
||||||
double range_to_show( void ) { return range_shown;}
|
float range_to_show( void ) { return range_shown;}
|
||||||
};
|
};
|
||||||
|
|
||||||
// hud_card_ This class displays the indicated quantity on
|
// hud_card_ This class displays the indicated quantity on
|
||||||
|
@ -346,24 +591,24 @@ class instr_scale : public instr_item {
|
||||||
|
|
||||||
class hud_card : public instr_scale {
|
class hud_card : public instr_scale {
|
||||||
private:
|
private:
|
||||||
double val_span;
|
float val_span;
|
||||||
double half_width_units;
|
float half_width_units;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
hud_card( int x,
|
hud_card( int x,
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR load_fn,
|
FLTFNPTR load_fn,
|
||||||
UINT options,
|
UINT options,
|
||||||
double maxValue = 100.0,
|
float maxValue = 100.0,
|
||||||
double minValue = 0.0,
|
float minValue = 0.0,
|
||||||
double disp_scaling = 1.0,
|
float disp_scaling = 1.0,
|
||||||
UINT major_divs = 10,
|
UINT major_divs = 10,
|
||||||
UINT minor_divs = 5,
|
UINT minor_divs = 5,
|
||||||
UINT modulator = 100,
|
UINT modulator = 100,
|
||||||
int dp_showing = 2,
|
int dp_showing = 2,
|
||||||
double value_span = 100.0,
|
float value_span = 100.0,
|
||||||
bool working = true);
|
bool working = true);
|
||||||
|
|
||||||
~hud_card();
|
~hud_card();
|
||||||
|
@ -376,18 +621,16 @@ class hud_card : public instr_scale {
|
||||||
typedef hud_card * pCardScale;
|
typedef hud_card * pCardScale;
|
||||||
|
|
||||||
class guage_instr : public instr_scale {
|
class guage_instr : public instr_scale {
|
||||||
private:
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
guage_instr( int x,
|
guage_instr( int x,
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR load_fn,
|
FLTFNPTR load_fn,
|
||||||
UINT options,
|
UINT options,
|
||||||
double disp_scaling = 1.0,
|
float disp_scaling = 1.0,
|
||||||
double maxValue = 100,
|
float maxValue = 100,
|
||||||
double minValue = 0,
|
float minValue = 0,
|
||||||
UINT major_divs = 50,
|
UINT major_divs = 50,
|
||||||
UINT minor_divs = 0,
|
UINT minor_divs = 0,
|
||||||
int dp_showing = 2,
|
int dp_showing = 2,
|
||||||
|
@ -407,15 +650,15 @@ typedef guage_instr * pGuageInst;
|
||||||
|
|
||||||
class dual_instr_item : public instr_item {
|
class dual_instr_item : public instr_item {
|
||||||
private:
|
private:
|
||||||
DBLFNPTR alt_data_source;
|
FLTFNPTR alt_data_source;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
dual_instr_item ( int x,
|
dual_instr_item ( int x,
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR chn1_source,
|
FLTFNPTR chn1_source,
|
||||||
DBLFNPTR chn2_source,
|
FLTFNPTR chn2_source,
|
||||||
bool working = true,
|
bool working = true,
|
||||||
UINT options = HUDS_TOP);
|
UINT options = HUDS_TOP);
|
||||||
|
|
||||||
|
@ -423,8 +666,8 @@ class dual_instr_item : public instr_item {
|
||||||
dual_instr_item( const dual_instr_item & image);
|
dual_instr_item( const dual_instr_item & image);
|
||||||
dual_instr_item & operator = (const dual_instr_item & rhs );
|
dual_instr_item & operator = (const dual_instr_item & rhs );
|
||||||
|
|
||||||
double current_ch1( void ) { return alt_data_source();}
|
float current_ch1( void ) { return (float)alt_data_source();}
|
||||||
double current_ch2( void ) { return get_value();}
|
float current_ch2( void ) { return (float)get_value();}
|
||||||
virtual void draw ( void ) { }
|
virtual void draw ( void ) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -439,11 +682,11 @@ class fgTBI_instr : public dual_instr_item {
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR chn1_source = get_roll,
|
FLTFNPTR chn1_source = get_roll,
|
||||||
DBLFNPTR chn2_source = get_sideslip,
|
FLTFNPTR chn2_source = get_sideslip,
|
||||||
double maxBankAngle = 45.0,
|
float maxBankAngle = 45.0,
|
||||||
double maxSlipAngle = 5.0,
|
float maxSlipAngle = 5.0,
|
||||||
UINT gap_width = 5.0,
|
UINT gap_width = 5,
|
||||||
bool working = true);
|
bool working = true);
|
||||||
|
|
||||||
fgTBI_instr( const fgTBI_instr & image);
|
fgTBI_instr( const fgTBI_instr & image);
|
||||||
|
@ -466,20 +709,20 @@ class HudLadder : public dual_instr_item {
|
||||||
UINT minor_div;
|
UINT minor_div;
|
||||||
UINT label_pos;
|
UINT label_pos;
|
||||||
UINT scr_hole;
|
UINT scr_hole;
|
||||||
double vmax;
|
float vmax;
|
||||||
double vmin;
|
float vmin;
|
||||||
double factor;
|
float factor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HudLadder( int x,
|
HudLadder( int x,
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR ptch_source = get_roll,
|
FLTFNPTR ptch_source = get_roll,
|
||||||
DBLFNPTR roll_source = get_pitch,
|
FLTFNPTR roll_source = get_pitch,
|
||||||
double span_units = 45.0,
|
float span_units = 45.0,
|
||||||
double division_units = 10.0,
|
float division_units = 10.0,
|
||||||
double minor_division = 0.0,
|
float minor_division = 0.0,
|
||||||
UINT screen_hole = 70,
|
UINT screen_hole = 70,
|
||||||
UINT lbl_pos = 0,
|
UINT lbl_pos = 0,
|
||||||
bool working = true );
|
bool working = true );
|
||||||
|
@ -511,6 +754,11 @@ extern void strokeString( int x,
|
||||||
char *msg,
|
char *msg,
|
||||||
void *font = GLUT_STROKE_ROMAN,
|
void *font = GLUT_STROKE_ROMAN,
|
||||||
float theta = 0);
|
float theta = 0);
|
||||||
|
//extern void strokeString(float xx,
|
||||||
|
// float yy,
|
||||||
|
// char *msg,
|
||||||
|
// void *font = GLUT_STROKE_ROMAN)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
bool AddHUDInstrument( instr_item *pBlackBox );
|
bool AddHUDInstrument( instr_item *pBlackBox );
|
||||||
void DrawHUD ( void );
|
void DrawHUD ( void );
|
||||||
|
@ -524,4 +772,3 @@ void fgHUDSetTimeMode( Hptr hud, int time_of_day );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif // _HUD_H
|
#endif // _HUD_H
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <Aircraft/aircraft.hxx>
|
#include <Aircraft/aircraft.hxx>
|
||||||
|
#include <GUI/gui.h>
|
||||||
#include <Include/fg_constants.h>
|
#include <Include/fg_constants.h>
|
||||||
#include <Math/fg_random.h>
|
#include <Math/fg_random.h>
|
||||||
#include <Math/mat3.h>
|
#include <Math/mat3.h>
|
||||||
|
@ -15,8 +16,12 @@
|
||||||
#include <Scenery/scenery.hxx>
|
#include <Scenery/scenery.hxx>
|
||||||
#include <Time/fg_timer.hxx>
|
#include <Time/fg_timer.hxx>
|
||||||
|
|
||||||
|
|
||||||
#include "hud.hxx"
|
#include "hud.hxx"
|
||||||
|
|
||||||
|
#ifdef USE_HUD_TextList
|
||||||
|
#define textString( x , y, text, font ) TextString( font, text, x , y )
|
||||||
|
#endif
|
||||||
|
|
||||||
//========== Top of hud_card class member definitions =============
|
//========== Top of hud_card class member definitions =============
|
||||||
|
|
||||||
hud_card ::
|
hud_card ::
|
||||||
|
@ -24,16 +29,16 @@ hud_card( int x,
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR data_source,
|
FLTFNPTR data_source,
|
||||||
UINT options,
|
UINT options,
|
||||||
double max_value,
|
float max_value, // 360
|
||||||
double min_value,
|
float min_value, // 0
|
||||||
double disp_scaling,
|
float disp_scaling,
|
||||||
UINT major_divs,
|
UINT major_divs,
|
||||||
UINT minor_divs,
|
UINT minor_divs,
|
||||||
UINT modulus,
|
UINT modulus, // 360
|
||||||
int dp_showing,
|
int dp_showing,
|
||||||
double value_span,
|
float value_span,
|
||||||
bool working) :
|
bool working) :
|
||||||
instr_scale( x,y,width,height,
|
instr_scale( x,y,width,height,
|
||||||
data_source, options,
|
data_source, options,
|
||||||
|
@ -44,6 +49,14 @@ hud_card( int x,
|
||||||
val_span ( value_span)
|
val_span ( value_span)
|
||||||
{
|
{
|
||||||
half_width_units = range_to_show() / 2.0;
|
half_width_units = range_to_show() / 2.0;
|
||||||
|
// UINT options = get_options();
|
||||||
|
// huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
|
||||||
|
// huds_right = options & HUDS_RIGHT;
|
||||||
|
// huds_left = options & HUDS_LEFT;
|
||||||
|
// huds_vert = options & HUDS_VERT;
|
||||||
|
// huds_notext = options & HUDS_NOTEXT;
|
||||||
|
// huds_top = options & HUDS_TOP;
|
||||||
|
// huds_bottom = options & HUDS_BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
hud_card ::
|
hud_card ::
|
||||||
|
@ -55,6 +68,14 @@ hud_card( const hud_card & image):
|
||||||
val_span( image.val_span),
|
val_span( image.val_span),
|
||||||
half_width_units (image.half_width_units)
|
half_width_units (image.half_width_units)
|
||||||
{
|
{
|
||||||
|
// UINT options = get_options();
|
||||||
|
// huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
|
||||||
|
// huds_right = options & HUDS_RIGHT;
|
||||||
|
// huds_left = options & HUDS_LEFT;
|
||||||
|
// huds_vert = options & HUDS_VERT;
|
||||||
|
// huds_notext = options & HUDS_NOTEXT;
|
||||||
|
// huds_top = options & HUDS_TOP;
|
||||||
|
// huds_bottom = options & HUDS_BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
hud_card & hud_card ::
|
hud_card & hud_card ::
|
||||||
|
@ -71,73 +92,97 @@ operator = (const hud_card & rhs )
|
||||||
void hud_card ::
|
void hud_card ::
|
||||||
draw( void ) // (HUD_scale * pscale )
|
draw( void ) // (HUD_scale * pscale )
|
||||||
{
|
{
|
||||||
double vmin, vmax;
|
float vmin, vmax;
|
||||||
int marker_xs;
|
int marker_xs;
|
||||||
int marker_xe;
|
int marker_xe;
|
||||||
int marker_ys;
|
int marker_ys;
|
||||||
int marker_ye;
|
int marker_ye;
|
||||||
/* register */ int i;
|
int lenstr;
|
||||||
|
int height, width;
|
||||||
|
int i, last;
|
||||||
char TextScale[80];
|
char TextScale[80];
|
||||||
bool condition;
|
bool condition;
|
||||||
int disp_val = 0;
|
int disp_val = 0;
|
||||||
POINT mid_scr = get_centroid();
|
POINT mid_scr = get_centroid();
|
||||||
double cur_value = get_value();
|
float cur_value = get_value();
|
||||||
RECT scrn_rect = get_location();
|
RECT scrn_rect = get_location();
|
||||||
UINT options = get_options();
|
UINT options = get_options();
|
||||||
|
|
||||||
|
height = scrn_rect.top + scrn_rect.bottom;
|
||||||
|
width = scrn_rect.left + scrn_rect.right;
|
||||||
|
|
||||||
vmin = cur_value - half_width_units; // width units == needle travel
|
vmin = cur_value - half_width_units; // width units == needle travel
|
||||||
vmax = cur_value + half_width_units; // or picture unit span.
|
vmax = cur_value + half_width_units; // or picture unit span.
|
||||||
// Draw the basic markings for the scale...
|
|
||||||
|
// Draw the basic markings for the scale...
|
||||||
if( options & HUDS_VERT ) { // Vertical scale
|
|
||||||
|
if( huds_vert(options) ) { // Vertical scale
|
||||||
drawOneLine( scrn_rect.left, // Bottom tick bar
|
drawOneLine( scrn_rect.left, // Bottom tick bar
|
||||||
scrn_rect.top,
|
scrn_rect.top,
|
||||||
scrn_rect.left + scrn_rect.right,
|
width,
|
||||||
scrn_rect.top);
|
scrn_rect.top);
|
||||||
|
|
||||||
drawOneLine( scrn_rect.left, // Top tick bar
|
drawOneLine( scrn_rect.left, // Top tick bar
|
||||||
scrn_rect.top + scrn_rect.bottom,
|
height,
|
||||||
scrn_rect.left + scrn_rect.right,
|
width,
|
||||||
scrn_rect.top + scrn_rect.bottom );
|
height );
|
||||||
|
|
||||||
|
marker_xs = scrn_rect.left; // x start
|
||||||
|
marker_xe = width; // x extent
|
||||||
|
marker_ye = height;
|
||||||
|
|
||||||
marker_xs = scrn_rect.left;
|
// glBegin(GL_LINES);
|
||||||
marker_xe = scrn_rect.left + scrn_rect.right;
|
|
||||||
|
// Bottom tick bar
|
||||||
|
// glVertex2f( marker_xs, scrn_rect.top);
|
||||||
|
// glVertex2f( marker_xe, scrn_rect.top);
|
||||||
|
|
||||||
|
// Top tick bar
|
||||||
|
// glVertex2f( marker_xs, marker_ye);
|
||||||
|
// glVertex2f( marker_xe, marker_ye );
|
||||||
|
// glEnd();
|
||||||
|
|
||||||
// We do not use else in the following so that combining the two
|
// We do not use else in the following so that combining the two
|
||||||
// options produces a "caged" display with double carrots. The
|
// options produces a "caged" display with double carrots. The
|
||||||
// same is done for horizontal card indicators.
|
// same is done for horizontal card indicators.
|
||||||
|
|
||||||
if( options & HUDS_LEFT ) { // Calculate x marker offset
|
if( huds_left(options) ) { // Calculate x marker offset
|
||||||
drawOneLine( scrn_rect.left + scrn_rect.right,
|
drawOneLine( marker_xe, scrn_rect.top,
|
||||||
scrn_rect.top,
|
marker_xe, marker_ye); // Cap right side
|
||||||
scrn_rect.left + scrn_rect.right,
|
|
||||||
scrn_rect.top + scrn_rect.bottom); // Cap right side
|
|
||||||
|
|
||||||
marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
|
marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
|
||||||
// Indicator carrot
|
// Indicator carrot
|
||||||
drawOneLine( marker_xs, mid_scr.y,
|
// drawOneLine( marker_xs, mid_scr.y,
|
||||||
marker_xe, mid_scr.y + scrn_rect.right / 6);
|
// marker_xe, mid_scr.y + scrn_rect.right / 6);
|
||||||
drawOneLine( marker_xs, mid_scr.y,
|
// drawOneLine( marker_xs, mid_scr.y,
|
||||||
marker_xe, mid_scr.y - scrn_rect.right / 6);
|
// marker_xe, mid_scr.y - scrn_rect.right / 6);
|
||||||
|
|
||||||
}
|
glBegin(GL_LINE_STRIP);
|
||||||
if( options & HUDS_RIGHT ) { // We'll default this for now.
|
glVertex2f( marker_xe, mid_scr.y + scrn_rect.right / 6);
|
||||||
drawOneLine( scrn_rect.left,
|
glVertex2f( marker_xs, mid_scr.y);
|
||||||
scrn_rect.top,
|
glVertex2f( marker_xe, mid_scr.y - scrn_rect.right / 6);
|
||||||
scrn_rect.left,
|
glEnd();
|
||||||
scrn_rect.top + scrn_rect.bottom); // Cap left side
|
}
|
||||||
|
if( huds_right(options) ) { // We'll default this for now.
|
||||||
|
drawOneLine( scrn_rect.left, scrn_rect.top,
|
||||||
|
scrn_rect.left, marker_ye ); // Cap left side
|
||||||
|
|
||||||
marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
|
marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
|
||||||
// Indicator carrot
|
// Indicator carrot
|
||||||
drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6,
|
// drawOneLine( scrn_rect.left, mid_scr.y + scrn_rect.right / 6,
|
||||||
marker_xe, mid_scr.y );
|
// marker_xe, mid_scr.y );
|
||||||
drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
|
// drawOneLine( scrn_rect.left, mid_scr.y - scrn_rect.right / 6,
|
||||||
marker_xe, mid_scr.y);
|
// marker_xe, mid_scr.y);
|
||||||
}
|
glBegin(GL_LINE_STRIP);
|
||||||
|
glVertex2f( scrn_rect.left, mid_scr.y + scrn_rect.right / 6);
|
||||||
|
glVertex2f( marker_xe, mid_scr.y );
|
||||||
|
glVertex2f( scrn_rect.left, mid_scr.y - scrn_rect.right / 6);
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
// At this point marker x_start and x_end values are transposed.
|
// At this point marker x_start and x_end values are transposed.
|
||||||
// To keep this from confusing things they are now interchanged.
|
// To keep this from confusing things they are now interchanged.
|
||||||
if(( options & HUDS_BOTH) == HUDS_BOTH) {
|
if(huds_both(options)) {
|
||||||
marker_ye = marker_xs;
|
marker_ye = marker_xs;
|
||||||
marker_xs = marker_xe;
|
marker_xs = marker_xe;
|
||||||
marker_xe = marker_ye;
|
marker_xe = marker_ye;
|
||||||
|
@ -146,7 +191,12 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
// Work through from bottom to top of scale. Calculating where to put
|
// Work through from bottom to top of scale. Calculating where to put
|
||||||
// minor and major ticks.
|
// minor and major ticks.
|
||||||
|
|
||||||
for( i = (int)vmin; i <= (int)vmax; i++ ) {
|
// last = FloatToInt(vmax)+1;
|
||||||
|
// i = FloatToInt(vmin);
|
||||||
|
last = (int)vmax + 1;
|
||||||
|
i = (int)vmin;
|
||||||
|
for( ; i <last ; i++ )
|
||||||
|
{
|
||||||
condition = true;
|
condition = true;
|
||||||
if( !modulo()) {
|
if( !modulo()) {
|
||||||
if( i < min_val()) {
|
if( i < min_val()) {
|
||||||
|
@ -156,28 +206,35 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
|
|
||||||
if( condition ) { // Show a tick if necessary
|
if( condition ) { // Show a tick if necessary
|
||||||
// Calculate the location of this tick
|
// Calculate the location of this tick
|
||||||
marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
|
marker_ys = scrn_rect.top + FloatToInt(((i - vmin) * factor()/*+.5f*/));
|
||||||
|
// marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
|
||||||
// Block calculation artifact from drawing ticks below min coordinate.
|
// Block calculation artifact from drawing ticks below min coordinate.
|
||||||
// Calculation here accounts for text height.
|
// Calculation here accounts for text height.
|
||||||
|
|
||||||
if(( marker_ys < (scrn_rect.top + 4)) |
|
if(( marker_ys < (scrn_rect.top + 4)) |
|
||||||
( marker_ys > (scrn_rect.top + scrn_rect.bottom - 4))) {
|
( marker_ys > (height - 4))) {
|
||||||
// Magic numbers!!!
|
// Magic numbers!!!
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if( div_min()) {
|
if( div_min()) {
|
||||||
if( (i%div_min()) == 0) {
|
// if( (i%div_min()) == 0) {
|
||||||
|
if( !(i%(int)div_min())) {
|
||||||
if((( marker_ys - 5) > scrn_rect.top ) &&
|
if((( marker_ys - 5) > scrn_rect.top ) &&
|
||||||
(( marker_ys + 5) < (scrn_rect.top + scrn_rect.bottom))){
|
(( marker_ys + 5) < (height))){
|
||||||
if( (options & HUDS_BOTH) == HUDS_BOTH ) {
|
if( huds_both(options) ) {
|
||||||
drawOneLine( scrn_rect.left, marker_ys,
|
drawOneLine( scrn_rect.left, marker_ys,
|
||||||
marker_xs, marker_ys );
|
marker_xs, marker_ys );
|
||||||
drawOneLine( marker_xe, marker_ys,
|
drawOneLine( marker_xe, marker_ys,
|
||||||
scrn_rect.left + scrn_rect.right, marker_ys );
|
width, marker_ys );
|
||||||
}
|
// glBegin(GL_LINES);
|
||||||
|
// glVertex2f( scrn_rect.left, marker_ys );
|
||||||
|
// glVertex2f( marker_xs, marker_ys );
|
||||||
|
// glVertex2f( marker_xe, marker_ys);
|
||||||
|
// glVertex2f( scrn_rect.left + scrn_rect.right, marker_ys );
|
||||||
|
// glEnd();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if( options & HUDS_LEFT ) {
|
if( huds_left(options) ) {
|
||||||
drawOneLine( marker_xs + 4, marker_ys,
|
drawOneLine( marker_xs + 4, marker_ys,
|
||||||
marker_xe, marker_ys );
|
marker_xe, marker_ys );
|
||||||
}
|
}
|
||||||
|
@ -189,46 +246,55 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( div_max()) {
|
if( div_max() ) {
|
||||||
if( !(i%(int)div_max())){
|
if( !(i%(int)div_max()) )
|
||||||
|
{
|
||||||
if(modulo()) {
|
if(modulo()) {
|
||||||
if( disp_val < 0) {
|
if( disp_val < 0) {
|
||||||
disp_val += modulo();
|
while(disp_val < 0)
|
||||||
|
disp_val += modulo();
|
||||||
|
// } else {
|
||||||
|
// disp_val = i % (int)modulo();
|
||||||
}
|
}
|
||||||
else {
|
disp_val = i % (int) modulo(); // ?????????
|
||||||
disp_val = i % modulo();
|
} else {
|
||||||
}
|
disp_val = i;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
disp_val = i;
|
lenstr = sprintf( TextScale, "%d",
|
||||||
}
|
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
||||||
sprintf( TextScale, "%d", (int)(disp_val * data_scaling() +.5));
|
// (int)(disp_val * data_scaling() +.5));
|
||||||
if(( (marker_ys - 8 ) > scrn_rect.top ) &&
|
if(( (marker_ys - 8 ) > scrn_rect.top ) &&
|
||||||
( (marker_ys + 8) < (scrn_rect.top + scrn_rect.bottom))){
|
( (marker_ys + 8) < (height))){
|
||||||
if( (options & HUDS_BOTH) == HUDS_BOTH) {
|
if( huds_both(options) ) {
|
||||||
drawOneLine( scrn_rect.left, marker_ys,
|
// drawOneLine( scrn_rect.left, marker_ys,
|
||||||
marker_xs, marker_ys);
|
// marker_xs, marker_ys);
|
||||||
drawOneLine( marker_xs, marker_ys,
|
// drawOneLine( marker_xs, marker_ys,
|
||||||
scrn_rect.left + scrn_rect.right,
|
// scrn_rect.left + scrn_rect.right,
|
||||||
marker_ys);
|
// marker_ys);
|
||||||
if( !(options & HUDS_NOTEXT)) {
|
glBegin(GL_LINE_STRIP);
|
||||||
textString ( marker_xs + 2, marker_ys,
|
glVertex2f( scrn_rect.left, marker_ys );
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
glVertex2f( marker_xs, marker_ys);
|
||||||
|
glVertex2f( width, marker_ys);
|
||||||
|
glEnd();
|
||||||
|
if( !huds_notext(options)) {
|
||||||
|
textString ( marker_xs + 2, marker_ys,
|
||||||
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
|
drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
|
||||||
if( !(options & HUDS_NOTEXT)) {
|
if( !huds_notext(options) ) {
|
||||||
if( options & HUDS_LEFT ) {
|
if( huds_left(options) ) {
|
||||||
textString( marker_xs - 8 * strlen(TextScale) - 2,
|
textString( marker_xs - 8 * lenstr - 2,
|
||||||
marker_ys - 4,
|
marker_ys - 4,
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
textString( marker_xe + 3 * strlen(TextScale),
|
textString( marker_xe + 3 * lenstr,
|
||||||
marker_ys - 4,
|
marker_ys - 4,
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // Else read oriented right
|
} // Else read oriented right
|
||||||
|
@ -238,50 +304,73 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
} // End for range of i from vmin to vmax
|
} // End for range of i from vmin to vmax
|
||||||
} // End if VERTICAL SCALE TYPE
|
} // End if VERTICAL SCALE TYPE
|
||||||
else { // Horizontal scale by default
|
else { // Horizontal scale by default
|
||||||
drawOneLine( scrn_rect.left, // left tick bar
|
// left tick bar
|
||||||
scrn_rect.top,
|
drawOneLine( scrn_rect.left, scrn_rect.top,
|
||||||
scrn_rect.left,
|
scrn_rect.left, height);
|
||||||
scrn_rect.top + scrn_rect.bottom);
|
|
||||||
|
|
||||||
drawOneLine( scrn_rect.left + scrn_rect.right, // right tick bar
|
// right tick bar
|
||||||
scrn_rect.top,
|
drawOneLine( width, scrn_rect.top,
|
||||||
scrn_rect.left + scrn_rect.right,
|
width,
|
||||||
scrn_rect.top + scrn_rect.bottom );
|
height );
|
||||||
|
|
||||||
|
marker_ys = scrn_rect.top; // Starting point for
|
||||||
|
marker_ye = height; // tick y location calcs
|
||||||
|
marker_xe = width;
|
||||||
|
|
||||||
marker_ys = scrn_rect.top; // Starting point for
|
// glBegin(GL_LINES);
|
||||||
marker_ye = scrn_rect.top + scrn_rect.bottom; // tick y location calcs
|
// left tick bar
|
||||||
|
// glVertex2f( scrn_rect.left, scrn_rect.top);
|
||||||
|
// glVertex2f( scrn_rect.left, marker_ye);
|
||||||
|
|
||||||
if( options & HUDS_TOP ) {
|
// right tick bar
|
||||||
drawOneLine( scrn_rect.left,
|
// glVertex2f( marker_xe, scrn_rect.top);
|
||||||
scrn_rect.top,
|
// glVertex2f( marker_xe, marker_ye );
|
||||||
scrn_rect.left + scrn_rect.right,
|
// glEnd();
|
||||||
scrn_rect.top); // Bottom box line
|
|
||||||
|
|
||||||
marker_ye = scrn_rect.top + scrn_rect.bottom / 2; // Tick point adjust
|
if( huds_top(options) ) {
|
||||||
// Bottom arrow
|
// Bottom box line
|
||||||
drawOneLine( mid_scr.x, marker_ye,
|
drawOneLine( scrn_rect.left,
|
||||||
mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
|
scrn_rect.top,
|
||||||
drawOneLine( mid_scr.x, marker_ye,
|
width,
|
||||||
mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
|
scrn_rect.top);
|
||||||
}
|
|
||||||
if( options & HUDS_BOTTOM) {
|
// Tick point adjust
|
||||||
drawOneLine( scrn_rect.left,
|
marker_ye = scrn_rect.top + scrn_rect.bottom / 2;
|
||||||
scrn_rect.top + scrn_rect.bottom,
|
|
||||||
scrn_rect.left + scrn_rect.right,
|
// Bottom arrow
|
||||||
scrn_rect.top + scrn_rect.bottom); // Top box line
|
// drawOneLine( mid_scr.x, marker_ye,
|
||||||
// Tick point adjust
|
// mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
|
||||||
marker_ys = scrn_rect.top +
|
// drawOneLine( mid_scr.x, marker_ye,
|
||||||
scrn_rect.bottom - scrn_rect.bottom / 2;
|
// mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
|
||||||
// Top arrow
|
|
||||||
drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
|
glBegin(GL_LINE_STRIP);
|
||||||
scrn_rect.top + scrn_rect.bottom,
|
glVertex2f( mid_scr.x - scrn_rect.bottom / 4, scrn_rect.top);
|
||||||
mid_scr.x ,
|
glVertex2f( mid_scr.x, marker_ye);
|
||||||
marker_ys );
|
glVertex2f( mid_scr.x + scrn_rect.bottom / 4, scrn_rect.top);
|
||||||
drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
|
glEnd();
|
||||||
scrn_rect.top + scrn_rect.bottom,
|
}
|
||||||
mid_scr.x ,
|
if( huds_bottom(options) ) {
|
||||||
marker_ys );
|
// Top box line
|
||||||
}
|
drawOneLine( scrn_rect.left, height,
|
||||||
|
width, height);
|
||||||
|
// Tick point adjust
|
||||||
|
marker_ys = height - scrn_rect.bottom / 2;
|
||||||
|
|
||||||
|
// Top arrow
|
||||||
|
// drawOneLine( mid_scr.x + scrn_rect.bottom / 4,
|
||||||
|
// scrn_rect.top + scrn_rect.bottom,
|
||||||
|
// mid_scr.x, marker_ys );
|
||||||
|
// drawOneLine( mid_scr.x - scrn_rect.bottom / 4,
|
||||||
|
// scrn_rect.top + scrn_rect.bottom,
|
||||||
|
// mid_scr.x , marker_ys );
|
||||||
|
glBegin(GL_LINE_STRIP);
|
||||||
|
glVertex2f( mid_scr.x + scrn_rect.bottom / 4,
|
||||||
|
height);
|
||||||
|
glVertex2f( mid_scr.x , marker_ys );
|
||||||
|
glVertex2f( mid_scr.x - scrn_rect.bottom / 4,
|
||||||
|
height);
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
// if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
|
// if(( options & HUDS_BOTTOM) == HUDS_BOTTOM ) {
|
||||||
// marker_xe = marker_ys;
|
// marker_xe = marker_ys;
|
||||||
|
@ -290,7 +379,13 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
|
// printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
|
||||||
for( i = (int)vmin; i <= (int)vmax; i++ ) {
|
|
||||||
|
// last = FloatToInt(vmax)+1;
|
||||||
|
// i = FloatToInt(vmin);
|
||||||
|
last = (int)vmax + 1;
|
||||||
|
i = (int)vmin;
|
||||||
|
for(; i <last ; i++ ) {
|
||||||
|
// for( i = (int)vmin; i <= (int)vmax; i++ ) {
|
||||||
// printf("<*> i = %d\n", i);
|
// printf("<*> i = %d\n", i);
|
||||||
condition = true;
|
condition = true;
|
||||||
if( !modulo()) {
|
if( !modulo()) {
|
||||||
|
@ -300,21 +395,29 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
}
|
}
|
||||||
// printf("<**> i = %d\n", i);
|
// printf("<**> i = %d\n", i);
|
||||||
if( condition ) {
|
if( condition ) {
|
||||||
marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
|
// marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
|
||||||
|
marker_xs = scrn_rect.left + FloatToInt(((i - vmin) * factor()/*+ .5f*/));
|
||||||
if( div_min()){
|
if( div_min()){
|
||||||
if( (i%(int)div_min()) == 0 ) {
|
// if( (i%(int)div_min()) == 0 ) {
|
||||||
|
if( !(i%(int)div_min() )) {
|
||||||
// draw in ticks only if they aren't too close to the edge.
|
// draw in ticks only if they aren't too close to the edge.
|
||||||
if((( marker_xs - 5) > scrn_rect.left ) &&
|
if((( marker_xs - 5) > scrn_rect.left ) &&
|
||||||
(( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
|
(( marker_xs + 5 )< (scrn_rect.left + scrn_rect.right))){
|
||||||
|
|
||||||
if( (options & HUDS_BOTH) == HUDS_BOTH ) {
|
if( huds_both(options) ) {
|
||||||
drawOneLine( marker_xs, scrn_rect.top,
|
drawOneLine( marker_xs, scrn_rect.top,
|
||||||
marker_xs, marker_ys - 4);
|
marker_xs, marker_ys - 4);
|
||||||
drawOneLine( marker_xs, marker_ye + 4,
|
drawOneLine( marker_xs, marker_ye + 4,
|
||||||
marker_xs, scrn_rect.top + scrn_rect.bottom);
|
marker_xs, height);
|
||||||
}
|
// glBegin(GL_LINES);
|
||||||
|
// glVertex2f( marker_xs, scrn_rect.top);
|
||||||
|
// glVertex2f( marker_xs, marker_ys - 4);
|
||||||
|
// glVertex2f( marker_xs, marker_ye + 4);
|
||||||
|
// glVertex2f( marker_xs, scrn_rect.top + scrn_rect.bottom);
|
||||||
|
// glEnd();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if( options & HUDS_TOP) {
|
if( huds_top(options)) {
|
||||||
drawOneLine( marker_xs, marker_ys,
|
drawOneLine( marker_xs, marker_ys,
|
||||||
marker_xs, marker_ye - 4);
|
marker_xs, marker_ye - 4);
|
||||||
}
|
}
|
||||||
|
@ -326,35 +429,40 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// printf("<***> i = %d\n", i);
|
// printf("<***> i = %d\n", i);
|
||||||
if( div_max()) {
|
if( div_max()) {
|
||||||
// printf("i = %d\n", i);
|
// printf("i = %d\n", i);
|
||||||
if( (i%(int)div_max())==0 ) {
|
// if( (i%(int)div_max())==0 ) {
|
||||||
|
if( !(i%(int)div_max()) ) {
|
||||||
if(modulo()) {
|
if(modulo()) {
|
||||||
if( disp_val < 0) {
|
if( disp_val < 0) {
|
||||||
disp_val += modulo();
|
while(disp_val<0)
|
||||||
}
|
disp_val += modulo();
|
||||||
else {
|
|
||||||
disp_val = i % modulo();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
disp_val = i % (int) modulo(); // ?????????
|
||||||
|
} else {
|
||||||
disp_val = i;
|
disp_val = i;
|
||||||
}
|
}
|
||||||
// printf("disp_val = %d\n", disp_val);
|
// printf("disp_val = %d\n", disp_val);
|
||||||
// printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
|
// printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.5));
|
||||||
sprintf( TextScale, "%d", (int)(disp_val * data_scaling() +.5));
|
lenstr = sprintf( TextScale, "%d",
|
||||||
|
// (int)(disp_val * data_scaling() +.5));
|
||||||
|
FloatToInt(disp_val * data_scaling()/*+.5*/));
|
||||||
// Draw major ticks and text only if far enough from the edge.
|
// Draw major ticks and text only if far enough from the edge.
|
||||||
if(( (marker_xs - 10)> scrn_rect.left ) &&
|
if(( (marker_xs - 10)> scrn_rect.left ) &&
|
||||||
( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
|
( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
|
||||||
if( (options & HUDS_BOTH) == HUDS_BOTH) {
|
if( huds_both(options) ) {
|
||||||
drawOneLine( marker_xs, scrn_rect.top,
|
// drawOneLine( marker_xs, scrn_rect.top,
|
||||||
marker_xs, marker_ys);
|
// marker_xs, marker_ys);
|
||||||
drawOneLine( marker_xs, marker_ye,
|
// drawOneLine( marker_xs, marker_ye,
|
||||||
marker_xs, scrn_rect.top + scrn_rect.bottom);
|
// marker_xs, scrn_rect.top + scrn_rect.bottom);
|
||||||
|
glBegin(GL_LINE_STRIP);
|
||||||
if( !(options & HUDS_NOTEXT)) {
|
glVertex2f( marker_xs, scrn_rect.top);
|
||||||
textString ( marker_xs - 4 * strlen(TextScale),
|
glVertex2f( marker_xs, marker_ye);
|
||||||
|
glVertex2f( marker_xs, height);
|
||||||
|
glEnd();
|
||||||
|
if( !huds_notext(options) ) {
|
||||||
|
textString ( marker_xs - 4 * lenstr,
|
||||||
marker_ys + 4,
|
marker_ys + 4,
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
}
|
}
|
||||||
|
@ -362,14 +470,14 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
else {
|
else {
|
||||||
drawOneLine( marker_xs, marker_ys,
|
drawOneLine( marker_xs, marker_ys,
|
||||||
marker_xs, marker_ye );
|
marker_xs, marker_ye );
|
||||||
if( !(options & HUDS_NOTEXT)) {
|
if( !huds_notext(options)) {
|
||||||
if( options & HUDS_TOP ) {
|
if( huds_top(options) ) {
|
||||||
textString ( marker_xs - 4 * strlen(TextScale),
|
textString ( marker_xs - 4 * lenstr,
|
||||||
scrn_rect.top + scrn_rect.bottom - 10,
|
height - 10,
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
textString( marker_xs - 4 * strlen(TextScale),
|
textString( marker_xs - 4 * lenstr,
|
||||||
scrn_rect.top,
|
scrn_rect.top,
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
}
|
}
|
||||||
|
@ -377,8 +485,8 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// printf("<****> i = %d\n", i);
|
// printf("<****> i = %d\n", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@ dual_instr_item ::
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR chn1_source,
|
FLTFNPTR chn1_source,
|
||||||
DBLFNPTR chn2_source,
|
FLTFNPTR chn2_source,
|
||||||
bool working,
|
bool working,
|
||||||
UINT options ):
|
UINT options ):
|
||||||
instr_item( x, y, width, height,
|
instr_item( x, y, width, height,
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <Aircraft/aircraft.hxx>
|
#include <Aircraft/aircraft.hxx>
|
||||||
|
#include <GUI/gui.h>
|
||||||
#include <Include/fg_constants.h>
|
#include <Include/fg_constants.h>
|
||||||
#include <Math/fg_random.h>
|
#include <Math/fg_random.h>
|
||||||
#include <Math/mat3.h>
|
#include <Math/mat3.h>
|
||||||
|
@ -15,8 +16,12 @@
|
||||||
#include <Scenery/scenery.hxx>
|
#include <Scenery/scenery.hxx>
|
||||||
#include <Time/fg_timer.hxx>
|
#include <Time/fg_timer.hxx>
|
||||||
|
|
||||||
|
|
||||||
#include "hud.hxx"
|
#include "hud.hxx"
|
||||||
|
|
||||||
|
#ifdef USE_HUD_TextList
|
||||||
|
#define textString( x , y, text, font ) TextString( font, text, x , y )
|
||||||
|
#endif
|
||||||
|
|
||||||
//============== Top of guage_instr class member definitions ==============
|
//============== Top of guage_instr class member definitions ==============
|
||||||
|
|
||||||
guage_instr ::
|
guage_instr ::
|
||||||
|
@ -24,11 +29,11 @@ guage_instr ::
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR load_fn,
|
FLTFNPTR load_fn,
|
||||||
UINT options,
|
UINT options,
|
||||||
double disp_scale,
|
float disp_scale,
|
||||||
double maxValue,
|
float maxValue,
|
||||||
double minValue,
|
float minValue,
|
||||||
UINT major_divs,
|
UINT major_divs,
|
||||||
UINT minor_divs,
|
UINT minor_divs,
|
||||||
int dp_showing,
|
int dp_showing,
|
||||||
|
@ -43,6 +48,15 @@ guage_instr ::
|
||||||
modulus, dp_showing,
|
modulus, dp_showing,
|
||||||
working)
|
working)
|
||||||
{
|
{
|
||||||
|
// UINT options = get_options();
|
||||||
|
// huds_vert = options & HUDS_VERT;
|
||||||
|
// huds_left = options & HUDS_LEFT;
|
||||||
|
// huds_right = options & HUDS_RIGHT;
|
||||||
|
// huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
|
||||||
|
// huds_noticks = options & HUDS_NOTICKS;
|
||||||
|
// huds_notext = options & HUDS_NOTEXT;
|
||||||
|
// huds_top = options & HUDS_TOP;
|
||||||
|
// huds_bottom = options & HUDS_BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
guage_instr ::
|
guage_instr ::
|
||||||
|
@ -54,6 +68,15 @@ guage_instr ::
|
||||||
guage_instr( const guage_instr & image):
|
guage_instr( const guage_instr & image):
|
||||||
instr_scale( (instr_scale &) image)
|
instr_scale( (instr_scale &) image)
|
||||||
{
|
{
|
||||||
|
// UINT options = get_options();
|
||||||
|
// huds_vert = options & HUDS_VERT;
|
||||||
|
// huds_left = options & HUDS_LEFT;
|
||||||
|
// huds_right = options & HUDS_RIGHT;
|
||||||
|
// huds_both = (options & HUDS_BOTH) == HUDS_BOTH;
|
||||||
|
// huds_noticks = options & HUDS_NOTICKS;
|
||||||
|
// huds_notext = options & HUDS_NOTEXT;
|
||||||
|
// huds_top = options & HUDS_TOP;
|
||||||
|
// huds_bottom = options & HUDS_BOTTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
guage_instr & guage_instr ::
|
guage_instr & guage_instr ::
|
||||||
|
@ -76,52 +99,60 @@ void guage_instr :: draw (void)
|
||||||
int marker_xs, marker_xe;
|
int marker_xs, marker_xe;
|
||||||
int marker_ys, marker_ye;
|
int marker_ys, marker_ye;
|
||||||
int text_x, text_y;
|
int text_x, text_y;
|
||||||
|
int width, height, bottom_4;
|
||||||
|
int lenstr;
|
||||||
int i;
|
int i;
|
||||||
char TextScale[80];
|
char TextScale[80];
|
||||||
bool condition;
|
bool condition;
|
||||||
int disp_val;
|
int disp_val = 0;
|
||||||
double vmin = min_val();
|
float vmin = min_val();
|
||||||
double vmax = max_val();
|
float vmax = max_val();
|
||||||
POINT mid_scr = get_centroid();
|
POINT mid_scr = get_centroid();
|
||||||
double cur_value = get_value();
|
float cur_value = get_value();
|
||||||
RECT scrn_rect = get_location();
|
RECT scrn_rect = get_location();
|
||||||
UINT options = get_options();
|
UINT options = get_options();
|
||||||
|
|
||||||
|
width = scrn_rect.left + scrn_rect.right;
|
||||||
|
height = scrn_rect.top + scrn_rect.bottom;
|
||||||
|
bottom_4 = scrn_rect.bottom / 4;
|
||||||
|
|
||||||
// Draw the basic markings for the scale...
|
// Draw the basic markings for the scale...
|
||||||
|
|
||||||
if( options & HUDS_VERT ) { // Vertical scale
|
if( huds_vert(options) ) { // Vertical scale
|
||||||
drawOneLine( scrn_rect.left, // Bottom tick bar
|
drawOneLine( scrn_rect.left, // Bottom tick bar
|
||||||
scrn_rect.top,
|
scrn_rect.top,
|
||||||
scrn_rect.left + scrn_rect.right,
|
width,
|
||||||
scrn_rect.top);
|
scrn_rect.top);
|
||||||
|
|
||||||
drawOneLine( scrn_rect.left, // Top tick bar
|
drawOneLine( scrn_rect.left, // Top tick bar
|
||||||
scrn_rect.top + scrn_rect.bottom,
|
height,
|
||||||
scrn_rect.left + scrn_rect.right,
|
width,
|
||||||
scrn_rect.top + scrn_rect.bottom );
|
height );
|
||||||
|
|
||||||
marker_xs = scrn_rect.left;
|
marker_xs = scrn_rect.left;
|
||||||
marker_xe = scrn_rect.left + scrn_rect.right;
|
marker_xe = width;
|
||||||
|
|
||||||
if( options & HUDS_LEFT ) { // Read left, so line down right side
|
if( huds_left(options) ) { // Read left, so line down right side
|
||||||
drawOneLine( scrn_rect.left + scrn_rect.right,
|
drawOneLine( width,
|
||||||
scrn_rect.top,
|
scrn_rect.top,
|
||||||
scrn_rect.left + scrn_rect.right,
|
width,
|
||||||
scrn_rect.top + scrn_rect.bottom);
|
height);
|
||||||
|
|
||||||
marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
|
marker_xs = marker_xe - scrn_rect.right / 3; // Adjust tick xs
|
||||||
}
|
}
|
||||||
if( options & HUDS_RIGHT ) { // Read right, so down left sides
|
|
||||||
|
if( huds_right(options) ) { // Read right, so down left sides
|
||||||
drawOneLine( scrn_rect.left,
|
drawOneLine( scrn_rect.left,
|
||||||
scrn_rect.top,
|
scrn_rect.top,
|
||||||
scrn_rect.left,
|
scrn_rect.left,
|
||||||
scrn_rect.top + scrn_rect.bottom);
|
height);
|
||||||
|
|
||||||
marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
|
marker_xe = scrn_rect.left + scrn_rect.right / 3; // Adjust tick xe
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point marker x_start and x_end values are transposed.
|
// At this point marker x_start and x_end values are transposed.
|
||||||
// To keep this from confusing things they are now interchanged.
|
// To keep this from confusing things they are now interchanged.
|
||||||
if(( options & HUDS_BOTH) == HUDS_BOTH) {
|
if( huds_both(options) ) {
|
||||||
marker_ye = marker_xs;
|
marker_ye = marker_xs;
|
||||||
marker_xs = marker_xe;
|
marker_xs = marker_xe;
|
||||||
marker_xe = marker_ye;
|
marker_xe = marker_ye;
|
||||||
|
@ -130,26 +161,29 @@ void guage_instr :: draw (void)
|
||||||
// Work through from bottom to top of scale. Calculating where to put
|
// Work through from bottom to top of scale. Calculating where to put
|
||||||
// minor and major ticks.
|
// minor and major ticks.
|
||||||
|
|
||||||
if( !(options & HUDS_NOTICKS )) { // If not no ticks...:)
|
if( !huds_noticks(options)) { // If not no ticks...:)
|
||||||
// Calculate x marker offsets
|
// Calculate x marker offsets
|
||||||
for( i = (int)vmin; i <= (int)vmax; i++ ) {
|
int last = (int)vmax + 1; //FloatToInt(vmax)+1;
|
||||||
|
i = (int)vmin; //FloatToInt(vmin);
|
||||||
|
for(; i <last ; i++ ) {
|
||||||
|
// for( i = (int)vmin; i <= (int)vmax; i++ ) {
|
||||||
|
|
||||||
// Calculate the location of this tick
|
// Calculate the location of this tick
|
||||||
marker_ys = scrn_rect.top + (int)((i - vmin) * factor() + .5);
|
marker_ys = scrn_rect.top + FloatToInt((i - vmin) * factor()/* +.5f*/);
|
||||||
|
|
||||||
// We compute marker_ys even though we don't know if we will use
|
// We compute marker_ys even though we don't know if we will use
|
||||||
// either major or minor divisions. Simpler.
|
// either major or minor divisions. Simpler.
|
||||||
|
|
||||||
if( div_min()) { // Minor tick marks
|
if( div_min()) { // Minor tick marks
|
||||||
if( (i%div_min()) == 0) {
|
if( !(i%(int)div_min()) ) {
|
||||||
if((options & HUDS_LEFT) && (options && HUDS_RIGHT)) {
|
if( huds_left(options) && huds_right(options) ) {
|
||||||
drawOneLine( scrn_rect.left, marker_ys,
|
drawOneLine( scrn_rect.left, marker_ys,
|
||||||
marker_xs - 3, marker_ys );
|
marker_xs - 3, marker_ys );
|
||||||
drawOneLine( marker_xe + 3, marker_ys,
|
drawOneLine( marker_xe + 3, marker_ys,
|
||||||
scrn_rect.left + scrn_rect.right, marker_ys );
|
width, marker_ys );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( options & HUDS_LEFT) {
|
if( huds_left(options) ) {
|
||||||
drawOneLine( marker_xs + 3, marker_ys, marker_xe, marker_ys );
|
drawOneLine( marker_xs + 3, marker_ys, marker_xe, marker_ys );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -164,31 +198,31 @@ void guage_instr :: draw (void)
|
||||||
// statement.
|
// statement.
|
||||||
|
|
||||||
if( div_max()) { // Major tick mark
|
if( div_max()) { // Major tick mark
|
||||||
if( (i%div_max()) == 0 ) {
|
if( !(i%(int)div_max()) ) {
|
||||||
if((options & HUDS_LEFT) && (options && HUDS_RIGHT)) {
|
if( huds_left(options) && huds_right(options) ) {
|
||||||
|
|
||||||
drawOneLine( scrn_rect.left, marker_ys,
|
drawOneLine( scrn_rect.left, marker_ys,
|
||||||
marker_xs, marker_ys );
|
marker_xs, marker_ys );
|
||||||
drawOneLine( marker_xe, marker_ys,
|
drawOneLine( marker_xe, marker_ys,
|
||||||
scrn_rect.left + scrn_rect.right, marker_ys );
|
width, marker_ys );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
|
drawOneLine( marker_xs, marker_ys, marker_xe, marker_ys );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !(options & HUDS_NOTEXT)) {
|
if( !huds_notext(options) ) {
|
||||||
disp_val = i;
|
disp_val = i;
|
||||||
sprintf( TextScale, "%d",disp_val * (int)(data_scaling() +.5));
|
lenstr = sprintf( TextScale, "%d",
|
||||||
|
FloatToInt(disp_val * data_scaling()/*+.5*/ ));
|
||||||
|
|
||||||
if((options & HUDS_LEFT) && (options && HUDS_RIGHT)) {
|
if( huds_left(options) && huds_right(options) ) {
|
||||||
text_x = mid_scr.x - 2 - ((3 * strlen( TextScale ))>>1);
|
text_x = mid_scr.x - 2 - ((3 * lenstr) >> 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( options & HUDS_LEFT ) {
|
if( huds_left(options) ) {
|
||||||
text_x = marker_xs - 2 - 3 * strlen( TextScale);
|
text_x = marker_xs - 2 - 3 * lenstr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
text_x = marker_xe + 10 - strlen( TextScale );
|
text_x = marker_xe + 10 - lenstr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Now we know where to put the text.
|
// Now we know where to put the text.
|
||||||
|
@ -203,70 +237,71 @@ void guage_instr :: draw (void)
|
||||||
// have been drawn, text_x and text_y may be recycled. This is used
|
// have been drawn, text_x and text_y may be recycled. This is used
|
||||||
// with the marker start stops to produce a pointer for each side reading
|
// with the marker start stops to produce a pointer for each side reading
|
||||||
|
|
||||||
text_y = scrn_rect.top + (int)((cur_value - vmin) * factor() + .5);
|
text_y = scrn_rect.top + FloatToInt((cur_value - vmin) * factor() /*+.5f*/);
|
||||||
// text_x = marker_xs - scrn_rect.left;
|
// text_x = marker_xs - scrn_rect.left;
|
||||||
|
|
||||||
if( options & HUDS_RIGHT ) {
|
if( huds_right(options) ) {
|
||||||
drawOneLine(scrn_rect.left, text_y + 5,
|
glBegin(GL_LINE_STRIP);
|
||||||
marker_xe, text_y);
|
glVertex2f( scrn_rect.left, text_y + 5);
|
||||||
drawOneLine(scrn_rect.left, text_y - 5,
|
glVertex2f( marker_xe, text_y);
|
||||||
marker_xe, text_y);
|
glVertex2f( scrn_rect.left, text_y - 5);
|
||||||
|
glEnd();
|
||||||
}
|
}
|
||||||
if( options & HUDS_LEFT ) {
|
if( huds_left(options) ) {
|
||||||
drawOneLine(scrn_rect.left + scrn_rect.right, text_y + 5,
|
glBegin(GL_LINE_STRIP);
|
||||||
marker_xs, text_y);
|
glVertex2f( width, text_y + 5);
|
||||||
drawOneLine(scrn_rect.left + scrn_rect.right, text_y - 5,
|
glVertex2f( marker_xs, text_y);
|
||||||
marker_xs, text_y);
|
glVertex2f( width, text_y - 5);
|
||||||
|
glEnd();
|
||||||
}
|
}
|
||||||
} // End if VERTICAL SCALE TYPE
|
} // End if VERTICAL SCALE TYPE
|
||||||
else { // Horizontal scale by default
|
else { // Horizontal scale by default
|
||||||
drawOneLine( scrn_rect.left, // left tick bar
|
drawOneLine( scrn_rect.left, // left tick bar
|
||||||
scrn_rect.top,
|
scrn_rect.top,
|
||||||
scrn_rect.left,
|
scrn_rect.left,
|
||||||
scrn_rect.top + scrn_rect.bottom);
|
height);
|
||||||
|
|
||||||
drawOneLine( scrn_rect.left + scrn_rect.right, // right tick bar
|
drawOneLine( width, // right tick bar
|
||||||
scrn_rect.top,
|
scrn_rect.top,
|
||||||
scrn_rect.left + scrn_rect.right,
|
width,
|
||||||
scrn_rect.top + scrn_rect.bottom );
|
height );
|
||||||
|
|
||||||
marker_ys = scrn_rect.top; // Starting point for
|
marker_ys = scrn_rect.top; // Starting point for
|
||||||
marker_ye = scrn_rect.top + scrn_rect.bottom; // tick y location calcs
|
marker_ye = height; // tick y location calcs
|
||||||
marker_xs = scrn_rect.left + (int)((cur_value - vmin) * factor() + .5);
|
marker_xs = scrn_rect.left + FloatToInt((cur_value - vmin) * factor() /*+ .5f*/);
|
||||||
|
|
||||||
if( options & HUDS_TOP ) {
|
if( huds_top(options) ) {
|
||||||
drawOneLine( scrn_rect.left,
|
drawOneLine( scrn_rect.left,
|
||||||
scrn_rect.top,
|
scrn_rect.top,
|
||||||
scrn_rect.left + scrn_rect.right,
|
width,
|
||||||
scrn_rect.top); // Bottom box line
|
scrn_rect.top); // Bottom box line
|
||||||
|
|
||||||
marker_ye = scrn_rect.top + scrn_rect.bottom / 2; // Tick point adjust
|
marker_ye = scrn_rect.top + scrn_rect.bottom / 2; // Tick point adjust
|
||||||
// Bottom arrow
|
// Bottom arrow
|
||||||
drawOneLine( marker_xs, marker_ye,
|
glBegin(GL_LINE_STRIP);
|
||||||
marker_xs - scrn_rect.bottom / 4, scrn_rect.top);
|
glVertex2f( marker_xs - bottom_4, scrn_rect.top);
|
||||||
drawOneLine( marker_xs, marker_ye,
|
glVertex2f( marker_xs, marker_ye);
|
||||||
marker_xs + scrn_rect.bottom / 4, scrn_rect.top);
|
glVertex2f( marker_xs + bottom_4, scrn_rect.top);
|
||||||
}
|
glEnd();
|
||||||
if( options & HUDS_BOTTOM) {
|
|
||||||
drawOneLine( scrn_rect.left,
|
|
||||||
scrn_rect.top + scrn_rect.bottom,
|
|
||||||
scrn_rect.left + scrn_rect.right,
|
|
||||||
scrn_rect.top + scrn_rect.bottom); // Top box line
|
|
||||||
// Tick point adjust
|
|
||||||
marker_ys = scrn_rect.top +
|
|
||||||
scrn_rect.bottom - scrn_rect.bottom / 2;
|
|
||||||
// Top arrow
|
|
||||||
drawOneLine( marker_xs + scrn_rect.bottom / 4,
|
|
||||||
scrn_rect.top + scrn_rect.bottom,
|
|
||||||
marker_xs,
|
|
||||||
marker_ys );
|
|
||||||
drawOneLine( marker_xs - scrn_rect.bottom / 4,
|
|
||||||
scrn_rect.top + scrn_rect.bottom,
|
|
||||||
marker_xs ,
|
|
||||||
marker_ys );
|
|
||||||
}
|
}
|
||||||
|
if( huds_bottom(options) ) {
|
||||||
|
// Top box line
|
||||||
|
drawOneLine( scrn_rect.left, height, width, height);
|
||||||
|
// Tick point adjust
|
||||||
|
marker_ys = height - scrn_rect.bottom / 2;
|
||||||
|
|
||||||
for( i = (int)vmin; i <= (int)vmax; i++ ) {
|
// Top arrow
|
||||||
|
glBegin(GL_LINE_STRIP);
|
||||||
|
glVertex2f( marker_xs + bottom_4, height);
|
||||||
|
glVertex2f( marker_xs, marker_ys );
|
||||||
|
glVertex2f( marker_xs - bottom_4, height);
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int last = (int)vmax + 1; //FloatToInt(vmax)+1;
|
||||||
|
i = (int)vmin; //FloatToInt(vmin);
|
||||||
|
for( ; i <last ; i++ ) {
|
||||||
condition = true;
|
condition = true;
|
||||||
if( !modulo()) {
|
if( !modulo()) {
|
||||||
if( i < min_val()) {
|
if( i < min_val()) {
|
||||||
|
@ -274,21 +309,22 @@ void guage_instr :: draw (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( condition ) {
|
if( condition ) {
|
||||||
marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5);
|
marker_xs = scrn_rect.left + FloatToInt((i - vmin) * factor()/* +.5f*/);
|
||||||
|
// marker_xs = scrn_rect.left + (int)((i - vmin) * factor() + .5f);
|
||||||
if( div_min()){
|
if( div_min()){
|
||||||
if( (i%(int)div_min()) == 0 ) {
|
if( !(i%(int)div_min()) ) {
|
||||||
// draw in ticks only if they aren't too close to the edge.
|
// draw in ticks only if they aren't too close to the edge.
|
||||||
if((( marker_xs + 5) > scrn_rect.left ) ||
|
if((( marker_xs + 5) > scrn_rect.left ) ||
|
||||||
(( marker_xs - 5 )< (scrn_rect.left + scrn_rect.right))){
|
(( marker_xs - 5 )< (width))){
|
||||||
|
|
||||||
if( (options & HUDS_BOTH) == HUDS_BOTH ) {
|
if( huds_both(options) ) {
|
||||||
drawOneLine( marker_xs, scrn_rect.top,
|
drawOneLine( marker_xs, scrn_rect.top,
|
||||||
marker_xs, marker_ys - 4);
|
marker_xs, marker_ys - 4);
|
||||||
drawOneLine( marker_xs, marker_ye + 4,
|
drawOneLine( marker_xs, marker_ye + 4,
|
||||||
marker_xs, scrn_rect.top + scrn_rect.bottom);
|
marker_xs, height);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( options & HUDS_TOP) {
|
if( huds_top(options) ) {
|
||||||
drawOneLine( marker_xs, marker_ys,
|
drawOneLine( marker_xs, marker_ys,
|
||||||
marker_xs, marker_ye - 4);
|
marker_xs, marker_ye - 4);
|
||||||
}
|
}
|
||||||
|
@ -301,46 +337,45 @@ void guage_instr :: draw (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( div_max()) {
|
if( div_max()) {
|
||||||
if( (i%(int)div_max())==0 ) {
|
if( !(i%(int)div_max()) ) {
|
||||||
if(modulo()) {
|
if(modulo()) {
|
||||||
if( disp_val < 0) {
|
if( disp_val < 0) {
|
||||||
disp_val += modulo();
|
while( disp_val < 0 ) {
|
||||||
}
|
disp_val += modulo();
|
||||||
else {
|
}
|
||||||
disp_val = i % modulo();
|
}
|
||||||
}
|
disp_val = i % (int)modulo();
|
||||||
|
} else {
|
||||||
|
disp_val = i;
|
||||||
}
|
}
|
||||||
else {
|
lenstr = 4 * sprintf( TextScale, "%d",
|
||||||
disp_val = i;
|
FloatToInt(disp_val * data_scaling()/* +.5*/ ));
|
||||||
}
|
|
||||||
sprintf( TextScale, "%d", (int)(disp_val * data_scaling() +.5));
|
|
||||||
// Draw major ticks and text only if far enough from the edge.
|
// Draw major ticks and text only if far enough from the edge.
|
||||||
if(( (marker_xs - 10)> scrn_rect.left ) &&
|
if(( (marker_xs - 10)> scrn_rect.left ) &&
|
||||||
( (marker_xs + 10) < (scrn_rect.left + scrn_rect.right))){
|
( (marker_xs + 10) < width )){
|
||||||
if( (options & HUDS_BOTH) == HUDS_BOTH) {
|
if( huds_both(options) ) {
|
||||||
drawOneLine( marker_xs, scrn_rect.top,
|
drawOneLine( marker_xs, scrn_rect.top,
|
||||||
marker_xs, marker_ys);
|
marker_xs, marker_ys);
|
||||||
drawOneLine( marker_xs, marker_ye,
|
drawOneLine( marker_xs, marker_ye,
|
||||||
marker_xs, scrn_rect.top + scrn_rect.bottom);
|
marker_xs, height);
|
||||||
|
|
||||||
if( !(options & HUDS_NOTEXT)) {
|
if( !huds_notext(options) ) {
|
||||||
textString ( marker_xs - 4 * strlen(TextScale),
|
textString ( marker_xs - lenstr, marker_ys + 4,
|
||||||
marker_ys + 4,
|
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
drawOneLine( marker_xs, marker_ys,
|
drawOneLine( marker_xs, marker_ys,
|
||||||
marker_xs, marker_ye );
|
marker_xs, marker_ye );
|
||||||
if( !(options & HUDS_NOTEXT)) {
|
|
||||||
if( options & HUDS_TOP ) {
|
if( !huds_notext(options) ) {
|
||||||
textString ( marker_xs - 4 * strlen(TextScale),
|
if( huds_top(options) ) {
|
||||||
scrn_rect.top + scrn_rect.bottom - 10,
|
textString ( marker_xs - lenstr,
|
||||||
|
height - 10,
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
textString( marker_xs - 4 * strlen(TextScale),
|
textString( marker_xs - lenstr, scrn_rect.top,
|
||||||
scrn_rect.top,
|
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,8 @@ instr_item ::
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR data_source,
|
FLTFNPTR data_source,
|
||||||
double data_scaling,
|
float data_scaling,
|
||||||
UINT options,
|
UINT options,
|
||||||
bool working) :
|
bool working) :
|
||||||
handle ( ++instances ),
|
handle ( ++instances ),
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <Aircraft/aircraft.hxx>
|
#include <Aircraft/aircraft.hxx>
|
||||||
|
#include <GUI/gui.h>
|
||||||
#include <Include/fg_constants.h>
|
#include <Include/fg_constants.h>
|
||||||
#include <Math/fg_random.h>
|
#include <Math/fg_random.h>
|
||||||
#include <Math/mat3.h>
|
#include <Math/mat3.h>
|
||||||
|
@ -15,20 +16,23 @@
|
||||||
#include <Scenery/scenery.hxx>
|
#include <Scenery/scenery.hxx>
|
||||||
#include <Time/fg_timer.hxx>
|
#include <Time/fg_timer.hxx>
|
||||||
|
|
||||||
|
|
||||||
#include "hud.hxx"
|
#include "hud.hxx"
|
||||||
|
|
||||||
|
#ifdef USE_HUD_TextList
|
||||||
|
#define textString( x , y, text, font ) TextString( font, text, x , y )
|
||||||
|
#endif
|
||||||
|
|
||||||
//======================= Top of instr_label class =========================
|
//======================= Top of instr_label class =========================
|
||||||
instr_label ::
|
instr_label ::
|
||||||
instr_label( int x,
|
instr_label( int x,
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR data_source,
|
FLTFNPTR data_source,
|
||||||
const char *label_format,
|
const char *label_format,
|
||||||
const char *pre_label_string,
|
const char *pre_label_string,
|
||||||
const char *post_label_string,
|
const char *post_label_string,
|
||||||
double scale_data,
|
float scale_data,
|
||||||
UINT options,
|
UINT options,
|
||||||
fgLabelJust justification,
|
fgLabelJust justification,
|
||||||
int font_size,
|
int font_size,
|
||||||
|
@ -43,6 +47,20 @@ instr_label ::
|
||||||
fontSize ( font_size ),
|
fontSize ( font_size ),
|
||||||
blink ( blinking )
|
blink ( blinking )
|
||||||
{
|
{
|
||||||
|
if( pre_str != NULL) {
|
||||||
|
if( post_str != NULL ) {
|
||||||
|
sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sprintf( format_buffer, "%s%s", pre_str, pformat );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if( post_str != NULL ) {
|
||||||
|
sprintf( format_buffer, "%s%s", pformat, post_str );
|
||||||
|
}
|
||||||
|
} // else do nothing if both pre and post strings are nulls. Interesting.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// I put this in to make it easy to construct a class member using the current
|
// I put this in to make it easy to construct a class member using the current
|
||||||
|
@ -61,35 +79,6 @@ instr_label :: instr_label( const instr_label & image) :
|
||||||
post_str ( image.post_str ),
|
post_str ( image.post_str ),
|
||||||
blink ( image.blink )
|
blink ( image.blink )
|
||||||
{
|
{
|
||||||
}
|
|
||||||
|
|
||||||
instr_label & instr_label ::operator = (const instr_label & rhs )
|
|
||||||
{
|
|
||||||
if( !(this == &rhs)) {
|
|
||||||
instr_item::operator = (rhs);
|
|
||||||
pformat = rhs.pformat;
|
|
||||||
fontSize = rhs.fontSize;
|
|
||||||
blink = rhs.blink;
|
|
||||||
justify = rhs.justify;
|
|
||||||
pre_str = rhs.pre_str;
|
|
||||||
post_str = rhs.post_str;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// draw Draws a label anywhere in the HUD
|
|
||||||
//
|
|
||||||
//
|
|
||||||
void instr_label ::
|
|
||||||
draw( void ) // Required method in base class
|
|
||||||
{
|
|
||||||
char format_buffer[80];
|
|
||||||
char label_buffer[80];
|
|
||||||
int posincr;
|
|
||||||
int lenstr;
|
|
||||||
RECT scrn_rect = get_location();
|
|
||||||
|
|
||||||
if( pre_str != NULL) {
|
if( pre_str != NULL) {
|
||||||
if( post_str != NULL ) {
|
if( post_str != NULL ) {
|
||||||
sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
|
sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
|
||||||
|
@ -104,20 +93,64 @@ draw( void ) // Required method in base class
|
||||||
}
|
}
|
||||||
} // else do nothing if both pre and post strings are nulls. Interesting.
|
} // else do nothing if both pre and post strings are nulls. Interesting.
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
instr_label & instr_label ::operator = (const instr_label & rhs )
|
||||||
|
{
|
||||||
|
if( !(this == &rhs)) {
|
||||||
|
instr_item::operator = (rhs);
|
||||||
|
pformat = rhs.pformat;
|
||||||
|
fontSize = rhs.fontSize;
|
||||||
|
blink = rhs.blink;
|
||||||
|
justify = rhs.justify;
|
||||||
|
pre_str = rhs.pre_str;
|
||||||
|
post_str = rhs.post_str;
|
||||||
|
strcpy(format_buffer,rhs.format_buffer);
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// draw Draws a label anywhere in the HUD
|
||||||
|
//
|
||||||
|
//
|
||||||
|
void instr_label ::
|
||||||
|
draw( void ) // Required method in base class
|
||||||
|
{
|
||||||
|
// char format_buffer[80];
|
||||||
|
char label_buffer[80];
|
||||||
|
int posincr;
|
||||||
|
int lenstr;
|
||||||
|
RECT scrn_rect = get_location();
|
||||||
|
|
||||||
|
// if( pre_str != NULL) {
|
||||||
|
// if( post_str != NULL ) {
|
||||||
|
// sprintf( format_buffer, "%s%s%s", pre_str, pformat, post_str );
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// sprintf( format_buffer, "%s%s", pre_str, pformat );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// if( post_str != NULL ) {
|
||||||
|
// sprintf( format_buffer, "%s%s", pformat, post_str );
|
||||||
|
// }
|
||||||
|
// } // else do nothing if both pre and post strings are nulls. Interesting.
|
||||||
|
|
||||||
if( data_available() ) {
|
if( data_available() ) {
|
||||||
sprintf( label_buffer, format_buffer, get_value() );
|
lenstr = sprintf( label_buffer, format_buffer, get_value() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sprintf( label_buffer, format_buffer );
|
lenstr = sprintf( label_buffer, format_buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUGHUD
|
#ifdef DEBUGHUD
|
||||||
fgPrintf( FG_COCKPIT, FG_DEBUG, format_buffer );
|
fgPrintf( FG_COCKPIT, FG_DEBUG, format_buffer );
|
||||||
fgPrintf( FG_COCKPIT, FG_DEBUG, "\n" );
|
fgPrintf( FG_COCKPIT, FG_DEBUG, "\n" );
|
||||||
fgPrintf( FG_COCKPIT, FG_DEBUG, label_buffer );
|
fgPrintf( FG_COCKPIT, FG_DEBUG, label_buffer );
|
||||||
fgPrintf( FG_COCKPIT, FG_DEBUG, "\n" );
|
fgPrintf( FG_COCKPIT, FG_DEBUG, "\n" );
|
||||||
#endif
|
#endif
|
||||||
lenstr = strlen( label_buffer );
|
// lenstr = strlen( label_buffer );
|
||||||
|
|
||||||
posincr = 0; // default to RIGHT_JUST ... center located calc: -lenstr*8;
|
posincr = 0; // default to RIGHT_JUST ... center located calc: -lenstr*8;
|
||||||
|
|
||||||
|
@ -129,7 +162,6 @@ draw( void ) // Required method in base class
|
||||||
posincr = - (lenstr << 8); // 0;
|
posincr = - (lenstr << 8); // 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fontSize == SMALL ) {
|
if( fontSize == SMALL ) {
|
||||||
textString( scrn_rect.left + posincr, scrn_rect.top,
|
textString( scrn_rect.left + posincr, scrn_rect.top,
|
||||||
label_buffer, GLUT_BITMAP_8_BY_13);
|
label_buffer, GLUT_BITMAP_8_BY_13);
|
||||||
|
|
|
@ -18,282 +18,317 @@
|
||||||
|
|
||||||
#include "hud.hxx"
|
#include "hud.hxx"
|
||||||
//====================== Top of HudLadder Class =======================
|
//====================== Top of HudLadder Class =======================
|
||||||
HudLadder ::
|
HudLadder :: HudLadder( int x,
|
||||||
HudLadder( int x,
|
int y,
|
||||||
int y,
|
UINT width,
|
||||||
UINT width,
|
UINT height,
|
||||||
UINT height,
|
FLTFNPTR ptch_source,
|
||||||
DBLFNPTR ptch_source,
|
FLTFNPTR roll_source,
|
||||||
DBLFNPTR roll_source,
|
float span_units,
|
||||||
double span_units,
|
float major_div,
|
||||||
double major_div,
|
float minor_div,
|
||||||
double minor_div,
|
UINT screen_hole,
|
||||||
UINT screen_hole,
|
UINT lbl_pos,
|
||||||
UINT lbl_pos,
|
bool working) :
|
||||||
bool working) :
|
dual_instr_item( x, y, width, height,
|
||||||
dual_instr_item( x, y, width, height,
|
ptch_source,
|
||||||
ptch_source,
|
roll_source,
|
||||||
roll_source,
|
working,
|
||||||
working,
|
HUDS_RIGHT),
|
||||||
HUDS_RIGHT),
|
width_units ( (int)(span_units) ),
|
||||||
width_units ( span_units ),
|
div_units ( (int)(major_div < 0? -major_div: major_div) ),
|
||||||
div_units ( major_div < 0? -major_div: major_div ),
|
minor_div ( (int)(minor_div) ),
|
||||||
minor_div ( minor_div ),
|
label_pos ( lbl_pos ),
|
||||||
label_pos ( lbl_pos ),
|
scr_hole ( screen_hole ),
|
||||||
scr_hole ( screen_hole ),
|
vmax ( span_units/2 ),
|
||||||
vmax ( span_units/2 ),
|
vmin ( -vmax )
|
||||||
vmin ( -vmax )
|
{
|
||||||
{
|
if( !width_units ) {
|
||||||
if( !width_units ) {
|
width_units = 45;
|
||||||
width_units = 45;
|
}
|
||||||
|
factor = (float)get_span() / (float) width_units;
|
||||||
|
}
|
||||||
|
|
||||||
|
HudLadder :: ~HudLadder()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
factor = (double)get_span() / (double) width_units;
|
|
||||||
}
|
HudLadder ::
|
||||||
|
HudLadder( const HudLadder & image ) :
|
||||||
HudLadder ::
|
dual_instr_item( (dual_instr_item &) image),
|
||||||
~HudLadder()
|
width_units ( image.width_units ),
|
||||||
{
|
div_units ( image.div_units ),
|
||||||
}
|
label_pos ( image.label_pos ),
|
||||||
|
scr_hole ( image.scr_hole ),
|
||||||
HudLadder ::
|
vmax ( image.vmax ),
|
||||||
HudLadder( const HudLadder & image ) :
|
vmin ( image.vmin ),
|
||||||
dual_instr_item( (dual_instr_item &) image),
|
factor ( image.factor )
|
||||||
width_units ( image.width_units ),
|
{
|
||||||
div_units ( image.div_units ),
|
}
|
||||||
label_pos ( image.label_pos ),
|
HudLadder & HudLadder :: operator = ( const HudLadder & rhs )
|
||||||
scr_hole ( image.scr_hole ),
|
{
|
||||||
vmax ( image.vmax ),
|
if( !(this == &rhs)) {
|
||||||
vmin ( image.vmin ),
|
(dual_instr_item &)(*this) = (dual_instr_item &)rhs;
|
||||||
factor ( image.factor )
|
width_units = rhs.width_units;
|
||||||
{
|
div_units = rhs.div_units;
|
||||||
}
|
label_pos = rhs.label_pos;
|
||||||
HudLadder & HudLadder ::
|
scr_hole = rhs.scr_hole;
|
||||||
operator = ( const HudLadder & rhs )
|
vmax = rhs.vmax;
|
||||||
{
|
vmin = rhs.vmin;
|
||||||
if( !(this == &rhs)) {
|
factor = rhs.factor;
|
||||||
(dual_instr_item &)(*this) = (dual_instr_item &)rhs;
|
}
|
||||||
width_units = rhs.width_units;
|
return *this;
|
||||||
div_units = rhs.div_units;
|
}
|
||||||
label_pos = rhs.label_pos;
|
|
||||||
scr_hole = rhs.scr_hole;
|
//
|
||||||
vmax = rhs.vmax;
|
// Draws a climb ladder in the center of the HUD
|
||||||
vmin = rhs.vmin;
|
//
|
||||||
factor = rhs.factor;
|
|
||||||
|
inline static void _strokeString(float xx, float yy, char *msg, void *font)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
if(*msg)
|
||||||
|
{
|
||||||
|
glTranslatef( xx, yy, 0);
|
||||||
|
glScalef(.075, .075, 0.0);
|
||||||
|
while ((c=*msg++)) {
|
||||||
|
glutStrokeCharacter( font, c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Draws a climb ladder in the center of the HUD
|
|
||||||
//
|
|
||||||
|
|
||||||
void HudLadder :: draw( void )
|
void HudLadder :: draw( void )
|
||||||
{
|
{
|
||||||
double roll_value;
|
float roll_value;
|
||||||
double pitch_value;
|
float pitch_value;
|
||||||
int marker_y;
|
float marker_y;
|
||||||
int x_ini;
|
float x_ini;
|
||||||
int x_end;
|
float x_end;
|
||||||
int y_ini;
|
float y_ini;
|
||||||
int y_end;
|
float y_end;
|
||||||
int new_x_ini;
|
|
||||||
int new_x_end;
|
|
||||||
int new_y_ini;
|
|
||||||
int new_y_end;
|
|
||||||
int i;
|
|
||||||
POINT centroid = get_centroid();
|
|
||||||
RECT box = get_location();
|
|
||||||
int scr_min = box.top;
|
|
||||||
int half_span = box.right >> 1;
|
|
||||||
char TextLadder[80];
|
|
||||||
int condition;
|
|
||||||
int label_length;
|
|
||||||
roll_value = current_ch2();
|
|
||||||
GLfloat sinRoll = sin( roll_value );
|
|
||||||
GLfloat cosRoll = cos( roll_value );
|
|
||||||
|
|
||||||
pitch_value = current_ch1() * RAD_TO_DEG;
|
int i;
|
||||||
vmin = pitch_value - (double)width_units/2.0;
|
POINT centroid = get_centroid();
|
||||||
vmax = pitch_value + (double)width_units/2.0;
|
RECT box = get_location();
|
||||||
|
|
||||||
// Box the target.
|
int half_span = box.right >> 1;
|
||||||
drawOneLine( centroid.x - 5, centroid.y, centroid.x, centroid.y + 5);
|
char TextLadder[80];
|
||||||
drawOneLine( centroid.x, centroid.y + 5, centroid.x + 5, centroid.y);
|
|
||||||
drawOneLine( centroid.x + 5, centroid.y, centroid.x, centroid.y - 5);
|
|
||||||
drawOneLine( centroid.x, centroid.y - 5, centroid.x - 5, centroid.y);
|
|
||||||
|
|
||||||
for( i=(int)vmin; i<=(int)vmax; i++ ) { // Through integer pitch values...
|
int label_length;
|
||||||
condition = 1;
|
roll_value = current_ch2();
|
||||||
if( condition ) {
|
|
||||||
marker_y = centroid.y + (int)(((double)(i - pitch_value) * factor) + .5);
|
float hole = (float)((scr_hole)/2);
|
||||||
if( div_units ) {
|
|
||||||
if( !(i % div_units )) { // At integral multiple of div
|
GLfloat mat[16];
|
||||||
sprintf( TextLadder, "%d", i );
|
|
||||||
label_length = strlen( TextLadder );
|
pitch_value = current_ch1() * RAD_TO_DEG;
|
||||||
if( scr_hole == 0 ) {
|
vmin = pitch_value - (float)width_units/2.0;
|
||||||
if( i ) {
|
vmax = pitch_value + (float)width_units/2.0;
|
||||||
x_ini = centroid.x - half_span;
|
|
||||||
}
|
|
||||||
else { // Make zero point wider on left
|
|
||||||
x_ini = centroid.x - half_span - 10;
|
|
||||||
}
|
|
||||||
y_ini = marker_y;
|
|
||||||
x_end = centroid.x + half_span;
|
|
||||||
y_end = marker_y;
|
|
||||||
new_x_ini = centroid.x + (int)(
|
|
||||||
(x_ini - centroid.x) * cosRoll -
|
|
||||||
(y_ini - centroid.y) * sinRoll);
|
|
||||||
new_y_ini = centroid.y + (int)( \
|
|
||||||
(x_ini - centroid.x) * sinRoll + \
|
|
||||||
(y_ini - centroid.y) * cosRoll);
|
|
||||||
new_x_end = centroid.x + (int)( \
|
|
||||||
(x_end - centroid.x) * cosRoll - \
|
|
||||||
(y_end - centroid.y) * sinRoll);
|
|
||||||
new_y_end = centroid.y + (int)( \
|
|
||||||
(x_end - centroid.x) * sinRoll + \
|
|
||||||
(y_end - centroid.y) * cosRoll);
|
|
||||||
|
|
||||||
if( i >= 0 ) { // Above zero draw solid lines
|
|
||||||
drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
|
|
||||||
}
|
|
||||||
else { // Below zero draw dashed lines.
|
|
||||||
glEnable(GL_LINE_STIPPLE);
|
|
||||||
glLineStipple( 1, 0x00FF );
|
|
||||||
drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
|
|
||||||
glDisable(GL_LINE_STIPPLE);
|
|
||||||
}
|
|
||||||
// Calculate the position of the left text and write it.
|
|
||||||
new_x_ini = centroid.x + (int)(
|
|
||||||
(x_ini - 8 * label_length- 4 - centroid.x) * cosRoll -
|
|
||||||
(y_ini - 4 ) * sinRoll);
|
|
||||||
new_y_ini = centroid.y + (int)(
|
|
||||||
(x_ini - 8 * label_length- 4 - centroid.x) * sinRoll +
|
|
||||||
(y_ini - 4 - centroid.y) * cosRoll);
|
|
||||||
strokeString( new_x_ini , new_y_ini ,
|
|
||||||
TextLadder, GLUT_STROKE_ROMAN,
|
|
||||||
roll_value );
|
|
||||||
|
|
||||||
// Calculate the position of the right text and write it.
|
// We will do everything with glLoadMatrix :-)
|
||||||
new_x_end = centroid.x + (int)( \
|
// to avoid multiple pushing and popping matrix stack
|
||||||
(x_end + 24 - 8 * label_length - centroid.x) * cosRoll - \
|
glPushMatrix();
|
||||||
(y_end - 4 - centroid.y) * sinRoll);
|
// glTranslatef( centroid.x, centroid.y, 0);
|
||||||
new_y_end = centroid.y + (int)( \
|
// glRotatef(roll_value * RAD_TO_DEG, 0.0, 0.0, 1.0);
|
||||||
(x_end + 24 - 8 * label_length - centroid.x) * sinRoll + \
|
// glGetFloatv(GL_MODELVIEW_MATRIX, mat);
|
||||||
(y_end - 4 - centroid.y) * cosRoll);
|
// this is the same as above
|
||||||
strokeString( new_x_end, new_y_end,
|
float sinx = sin(roll_value);
|
||||||
TextLadder, GLUT_STROKE_ROMAN,
|
float cosx = cos(roll_value);
|
||||||
roll_value );
|
mat[0] = cosx;
|
||||||
|
mat[1] = sinx;
|
||||||
|
mat[2] = mat[3] = 0.0;
|
||||||
|
mat[4] = -sinx;
|
||||||
|
mat[5] = cosx;
|
||||||
|
mat[6] = mat[7] = mat[8] = mat[9];
|
||||||
|
mat[10] = 1.0;
|
||||||
|
mat[11] = 0.0;
|
||||||
|
mat[12] = centroid.x;
|
||||||
|
mat[13] = centroid.y;
|
||||||
|
mat[14] = 0;
|
||||||
|
mat[15] = 1.0;
|
||||||
|
glLoadMatrixf( mat );
|
||||||
|
|
||||||
|
// Draw the target spot.
|
||||||
|
#define CENTER_DIAMOND_SIZE 5.0
|
||||||
|
glBegin(GL_LINE_LOOP);
|
||||||
|
glVertex2f( -CENTER_DIAMOND_SIZE, 0.0);
|
||||||
|
glVertex2f(0.0, CENTER_DIAMOND_SIZE);
|
||||||
|
glVertex2f( CENTER_DIAMOND_SIZE, 0.0);
|
||||||
|
glVertex2f(0.0, -CENTER_DIAMOND_SIZE);
|
||||||
|
glEnd();
|
||||||
|
#if 0
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex2f( -CENTER_DIAMOND_SIZE, 0);
|
||||||
|
glVertex2f( -(CENTER_DIAMOND_SIZE*2), 0);
|
||||||
|
glVertex2f(0, CENTER_DIAMOND_SIZE);
|
||||||
|
glVertex2f(0, (CENTER_DIAMOND_SIZE*2));
|
||||||
|
glVertex2f( CENTER_DIAMOND_SIZE, 0);
|
||||||
|
glVertex2f( (CENTER_DIAMOND_SIZE*2), 0);
|
||||||
|
glVertex2f(0, -CENTER_DIAMOND_SIZE);
|
||||||
|
glVertex2f(0, -(CENTER_DIAMOND_SIZE*2));
|
||||||
|
glEnd();
|
||||||
|
#endif // 0
|
||||||
|
#undef CENTER_DIAMOND_SIZE
|
||||||
|
|
||||||
|
int last =FloatToInt(vmax)+1;
|
||||||
|
i = FloatToInt(vmin);
|
||||||
|
if( div_units ) {
|
||||||
|
if( !scr_hole ) {
|
||||||
|
for( ; i <last ; i++ ) {
|
||||||
|
|
||||||
|
marker_y = /*(int)*/(((float)(i - pitch_value) * factor) + .5);
|
||||||
|
if( !(i % div_units )) { // At integral multiple of div
|
||||||
|
|
||||||
|
label_length = sprintf( TextLadder, "%d", i );
|
||||||
|
|
||||||
|
if( i ) {
|
||||||
|
x_ini = -half_span;
|
||||||
|
} else { // Make zero point wider on left
|
||||||
|
x_ini = -half_span - 10;
|
||||||
|
}
|
||||||
|
x_end = half_span;
|
||||||
|
|
||||||
|
y_ini = marker_y;
|
||||||
|
y_end = marker_y;
|
||||||
|
|
||||||
|
// printf("(%.1f %.1f) (%.1f %.1f)\n",x_ini,y_ini,x_end,y_end);
|
||||||
|
|
||||||
|
if( i >= 0 ) { // Above zero draw solid lines
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex2f( x_ini, y_ini);
|
||||||
|
glVertex2f( x_end, y_end );
|
||||||
|
glEnd();
|
||||||
|
} else { // Below zero draw dashed lines.
|
||||||
|
glEnable(GL_LINE_STIPPLE);
|
||||||
|
glLineStipple( 1, 0x00FF );
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex2f( x_ini, y_ini);
|
||||||
|
glVertex2f( x_end, y_end );
|
||||||
|
glEnd();
|
||||||
|
glDisable(GL_LINE_STIPPLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the position of the left text and write it.
|
||||||
|
x_ini -= ( 8*label_length - 4);
|
||||||
|
y_ini -= 4;
|
||||||
|
_strokeString(x_ini, y_ini,
|
||||||
|
TextLadder, GLUT_STROKE_ROMAN );
|
||||||
|
|
||||||
|
glLoadMatrixf( mat );
|
||||||
|
// Calculate the position of the right text and write it.
|
||||||
|
x_end -= (24 - 8 * label_length);
|
||||||
|
y_end -= 4;
|
||||||
|
_strokeString(x_end, y_end,
|
||||||
|
TextLadder, GLUT_STROKE_ROMAN );
|
||||||
|
glLoadMatrixf( mat );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else { // Draw ladder with space in the middle of the lines
|
}
|
||||||
|
else // if(scr_hole )
|
||||||
|
{ // Draw ladder with space in the middle of the lines
|
||||||
|
last =FloatToInt(vmax)+1;
|
||||||
|
i = FloatToInt(vmin);
|
||||||
|
for( ; i <last ; i++ ) {
|
||||||
|
marker_y = /*(int)*/(((float)(i - pitch_value) * factor) + .5);
|
||||||
|
if( !(i % div_units )) { // At integral multiple of div
|
||||||
|
|
||||||
|
label_length = sprintf( TextLadder, "%d", i );
|
||||||
|
|
||||||
// Start by calculating the points and drawing the
|
// Start by calculating the points and drawing the
|
||||||
// left side lines.
|
// left side lines.
|
||||||
if( i != 0 ) {
|
if( i != 0 ) {
|
||||||
x_ini = centroid.x - half_span;
|
x_ini = -half_span;
|
||||||
}
|
} else {
|
||||||
else {
|
x_ini = -half_span - 10;
|
||||||
x_ini = centroid.x - half_span - 10;
|
}
|
||||||
}
|
x_end = -half_span + hole;
|
||||||
y_ini = marker_y;
|
|
||||||
x_end = centroid.x - half_span + scr_hole/2;
|
y_ini = marker_y;
|
||||||
y_end = marker_y;
|
y_end = marker_y;
|
||||||
|
|
||||||
|
// printf("half_span(%d) scr_hole(%d)\n", half_span, scr_hole);
|
||||||
|
// printf("x_end(%f) %f\n",x_end,(float)(-half_span + scr_hole/2));
|
||||||
|
// printf("L: (%.1f %.1f) (%.1f %.1f)\n",x_ini,y_ini,x_end,y_end);
|
||||||
|
|
||||||
|
if( i >= 0 ) { // Above zero draw solid lines
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex2f( x_ini, y_ini);
|
||||||
|
glVertex2f( x_end, y_end );
|
||||||
|
glEnd();
|
||||||
|
} else { // Below zero draw dashed lines.
|
||||||
|
glEnable(GL_LINE_STIPPLE);
|
||||||
|
glLineStipple( 1, 0x00FF );
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex2f( x_ini, y_ini);
|
||||||
|
glVertex2f( x_end, y_end );
|
||||||
|
glEnd();
|
||||||
|
glDisable(GL_LINE_STIPPLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now calculate the location of the left side label using
|
||||||
|
// the previously calculated start of the left side line.
|
||||||
|
|
||||||
|
x_ini -= (label_length + 32);
|
||||||
|
if( i < 0) {
|
||||||
|
x_ini -= 8;
|
||||||
|
} else {
|
||||||
|
if( i == 0 ) {
|
||||||
|
x_ini += 15; //20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
y_ini -= 4;
|
||||||
|
|
||||||
new_x_end = centroid.x+ (int)( \
|
_strokeString(x_ini, y_ini,
|
||||||
(x_end - centroid.x) * cosRoll -\
|
TextLadder, GLUT_STROKE_MONO_ROMAN );
|
||||||
(y_end - centroid.y) * sinRoll);
|
glLoadMatrixf( mat );
|
||||||
new_y_end = centroid.y+ (int)( \
|
|
||||||
(x_end - centroid.x) * sinRoll +\
|
// Now calculate and draw the right side line location
|
||||||
(y_end - centroid.y) * cosRoll);
|
x_ini = half_span - hole;
|
||||||
new_x_ini = centroid.x + (int)( \
|
y_ini = marker_y;
|
||||||
(x_ini - centroid.x) * cosRoll -\
|
if( i != 0 ) {
|
||||||
(y_ini - centroid.y) * sinRoll);
|
x_end = half_span;
|
||||||
new_y_ini = centroid.y + (int)( \
|
} else {
|
||||||
(x_ini - centroid.x) * sinRoll +\
|
x_end = half_span + 10;
|
||||||
(y_ini - centroid.y) * cosRoll);
|
}
|
||||||
|
y_end = marker_y;
|
||||||
if( i >= 0 )
|
|
||||||
{
|
// printf("R: (%.1f %.1f) (%.1f %.1f)\n",x_ini,y_ini,x_end,y_end);
|
||||||
drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
|
|
||||||
}
|
if( i >= 0 ) { // Above zero draw solid lines
|
||||||
else {
|
glBegin(GL_LINES);
|
||||||
glEnable(GL_LINE_STIPPLE);
|
glVertex2f( x_ini, y_ini);
|
||||||
glLineStipple( 1, 0x00FF );
|
glVertex2f( x_end, y_end );
|
||||||
drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
|
glEnd();
|
||||||
glDisable(GL_LINE_STIPPLE);
|
} else { // Below zero draw dashed lines.
|
||||||
}
|
glEnable(GL_LINE_STIPPLE);
|
||||||
// Now calculate the location of the left side label using
|
glLineStipple( 1, 0x00FF );
|
||||||
// the previously calculated start of the left side line.
|
glBegin(GL_LINES);
|
||||||
|
glVertex2f( x_ini, y_ini);
|
||||||
x_ini = x_ini - (label_length + 32 + centroid.x);
|
glVertex2f( x_end, y_end );
|
||||||
if( i < 0) {
|
glEnd();
|
||||||
x_ini -= 8;
|
glDisable(GL_LINE_STIPPLE);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if( i == 0 ) {
|
// Calculate the location and draw the right side label
|
||||||
x_ini += 20;
|
// using the end of the line as previously calculated.
|
||||||
|
x_end -= (label_length - 24);
|
||||||
|
|
||||||
|
if( i <= 0 ) {
|
||||||
|
x_end -= 8;
|
||||||
|
} // else if( i==0)
|
||||||
|
// {
|
||||||
|
// x_end -=4;
|
||||||
|
// }
|
||||||
|
|
||||||
|
y_end = marker_y - 4;
|
||||||
|
_strokeString(x_end, y_end,
|
||||||
|
TextLadder, GLUT_STROKE_MONO_ROMAN );
|
||||||
|
glLoadMatrixf( mat );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
y_ini = y_ini - ( 4 + centroid.y);
|
|
||||||
|
|
||||||
new_x_ini = centroid.x + (int)(x_ini * cosRoll - y_ini * sinRoll);
|
|
||||||
new_y_ini = centroid.y + (int)(x_ini * sinRoll + y_ini * cosRoll);
|
|
||||||
strokeString( new_x_ini , new_y_ini ,
|
|
||||||
TextLadder, GLUT_STROKE_MONO_ROMAN,
|
|
||||||
roll_value );
|
|
||||||
|
|
||||||
// Now calculate and draw the right side line location
|
|
||||||
x_ini = centroid.x + half_span - scr_hole/2;
|
|
||||||
y_ini = marker_y;
|
|
||||||
if( i != 0 ) {
|
|
||||||
x_end = centroid.x + half_span;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
x_end = centroid.x + half_span + 10;
|
|
||||||
}
|
|
||||||
y_end = marker_y;
|
|
||||||
|
|
||||||
new_x_ini = centroid.x + (int)( \
|
|
||||||
(x_ini-centroid.x)*cosRoll -\
|
|
||||||
(y_ini-centroid.y)*sinRoll);
|
|
||||||
new_y_ini = centroid.y + (int)( \
|
|
||||||
(x_ini-centroid.x)*sinRoll +\
|
|
||||||
(y_ini-centroid.y)*cosRoll);
|
|
||||||
new_x_end = centroid.x + (int)( \
|
|
||||||
(x_end-centroid.x)*cosRoll -\
|
|
||||||
(y_end-centroid.y)*sinRoll);
|
|
||||||
new_y_end = centroid.y + (int)( \
|
|
||||||
(x_end-centroid.x)*sinRoll +\
|
|
||||||
(y_end-centroid.y)*cosRoll);
|
|
||||||
|
|
||||||
if( i >= 0 )
|
|
||||||
{
|
|
||||||
drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
glEnable(GL_LINE_STIPPLE);
|
|
||||||
glLineStipple( 1, 0x00FF );
|
|
||||||
drawOneLine( new_x_ini, new_y_ini, new_x_end, new_y_end );
|
|
||||||
glDisable(GL_LINE_STIPPLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate the location and draw the right side label
|
|
||||||
// using the end of the line as previously calculated.
|
|
||||||
x_end -= centroid.x + label_length - 24;
|
|
||||||
if( i < 0 ) {
|
|
||||||
x_end -= 8;
|
|
||||||
}
|
|
||||||
y_end = marker_y - ( 4 + centroid.y);
|
|
||||||
new_x_end = centroid.x + (int)( (GLfloat)x_end * cosRoll -
|
|
||||||
(GLfloat)y_end * sinRoll);
|
|
||||||
new_y_end = centroid.y + (int)( (GLfloat)x_end * sinRoll +
|
|
||||||
(GLfloat)y_end * cosRoll);
|
|
||||||
strokeString( new_x_end, new_y_end,
|
|
||||||
TextLadder, GLUT_STROKE_MONO_ROMAN,
|
|
||||||
roll_value );
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,12 @@ instr_scale ( int x,
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR load_fn,
|
FLTFNPTR load_fn,
|
||||||
UINT options,
|
UINT options,
|
||||||
double show_range,
|
float show_range,
|
||||||
double maxValue,
|
float maxValue,
|
||||||
double minValue,
|
float minValue,
|
||||||
double disp_scale,
|
float disp_scale,
|
||||||
UINT major_divs,
|
UINT major_divs,
|
||||||
UINT minor_divs,
|
UINT minor_divs,
|
||||||
UINT rollover,
|
UINT rollover,
|
||||||
|
@ -57,11 +57,11 @@ instr_scale ( int x,
|
||||||
{
|
{
|
||||||
int temp;
|
int temp;
|
||||||
|
|
||||||
scale_factor = (double)get_span() / range_shown;
|
scale_factor = (float)get_span() / range_shown;
|
||||||
if( show_range < 0 ) {
|
if( show_range < 0 ) {
|
||||||
range_shown = -range_shown;
|
range_shown = -range_shown;
|
||||||
}
|
}
|
||||||
temp = (Maximum_value - Minimum_value) / 100;
|
temp = FloatToInt(Maximum_value - Minimum_value) / 100;
|
||||||
if( range_shown < temp ) {
|
if( range_shown < temp ) {
|
||||||
range_shown = temp;
|
range_shown = temp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@ fgTBI_instr( int x,
|
||||||
int y,
|
int y,
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR chn1_source,
|
FLTFNPTR chn1_source,
|
||||||
DBLFNPTR chn2_source,
|
FLTFNPTR chn2_source,
|
||||||
double maxBankAngle,
|
float maxBankAngle,
|
||||||
double maxSlipAngle,
|
float maxSlipAngle,
|
||||||
UINT gap_width,
|
UINT gap_width,
|
||||||
bool working ) :
|
bool working ) :
|
||||||
dual_instr_item( x, y, width, height,
|
dual_instr_item( x, y, width, height,
|
||||||
|
@ -35,8 +35,8 @@ fgTBI_instr( int x,
|
||||||
chn2_source,
|
chn2_source,
|
||||||
working,
|
working,
|
||||||
HUDS_TOP),
|
HUDS_TOP),
|
||||||
BankLimit (maxBankAngle),
|
BankLimit ((int)(maxBankAngle)),
|
||||||
SlewLimit (maxSlipAngle),
|
SlewLimit ((int)(maxSlipAngle)),
|
||||||
scr_hole (gap_width )
|
scr_hole (gap_width )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -64,127 +64,80 @@ operator = (const fgTBI_instr & rhs )
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Draws a Turn Bank Indicator on the screen
|
// Draws a Turn Bank Indicator on the screen
|
||||||
//
|
//
|
||||||
|
|
||||||
void fgTBI_instr :: draw( void )
|
void fgTBI_instr :: draw( void )
|
||||||
{
|
{
|
||||||
int x_inc1, y_inc1;
|
float bank_angle, sideslip_angle;
|
||||||
int x_inc2, y_inc2;
|
float ss_const; // sideslip angle pixels per rad
|
||||||
int x_t_inc1, y_t_inc1;
|
float cen_x, cen_y, bank, fspan, tee, hole;
|
||||||
|
|
||||||
int d_bottom_x, d_bottom_y;
|
int span = get_span();
|
||||||
int d_right_x, d_right_y;
|
|
||||||
int d_top_x, d_top_y;
|
float zero = 0.0;
|
||||||
int d_left_x, d_left_y;
|
|
||||||
|
RECT My_box = get_location();
|
||||||
|
POINT centroid = get_centroid();
|
||||||
|
int tee_height = My_box.bottom;
|
||||||
|
|
||||||
int inc_b_x, inc_b_y;
|
bank_angle = current_ch2(); // Roll limit +/- 30 degrees
|
||||||
int inc_r_x, inc_r_y;
|
|
||||||
int inc_t_x, inc_t_y;
|
if( bank_angle < -FG_PI_2/3 ) {
|
||||||
int inc_l_x, inc_l_y;
|
bank_angle = -FG_PI_2/3;
|
||||||
RECT My_box = get_location();
|
} else if( bank_angle > FG_PI_2/3 ) {
|
||||||
POINT centroid = get_centroid();
|
bank_angle = FG_PI_2/3;
|
||||||
int tee_height = My_box.bottom;
|
}
|
||||||
|
|
||||||
|
sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees
|
||||||
|
|
||||||
|
if( sideslip_angle < -FG_PI/9 ) {
|
||||||
|
sideslip_angle = -FG_PI/9;
|
||||||
|
} else if( sideslip_angle > FG_PI/9 ) {
|
||||||
|
sideslip_angle = FG_PI/9;
|
||||||
|
}
|
||||||
|
|
||||||
// struct fgFLIGHT *f = ¤t_aircraft.flight;
|
cen_x = centroid.x;
|
||||||
double sin_bank, cos_bank;
|
cen_y = centroid.y;
|
||||||
double bank_angle, sideslip_angle;
|
bank = bank_angle * RAD_TO_DEG;
|
||||||
double ss_const; // sideslip angle pixels per rad
|
tee = -tee_height;
|
||||||
|
fspan = span;
|
||||||
bank_angle = current_ch2(); // Roll limit +/- 30 degrees
|
hole = scr_hole;
|
||||||
if( bank_angle < -FG_PI_2/3 ) {
|
ss_const = 2 * sideslip_angle * fspan/(FG_2PI/9); // width represents 40 degrees
|
||||||
bank_angle = -FG_PI_2/3;
|
|
||||||
}
|
// printf("side_slip: %f fspan: %f\n", sideslip_angle, fspan);
|
||||||
else
|
// printf("ss_const: %f hole: %f\n", ss_const, hole);
|
||||||
if( bank_angle > FG_PI_2/3 ) {
|
|
||||||
bank_angle = FG_PI_2/3;
|
glPushMatrix();
|
||||||
}
|
glTranslatef(cen_x, cen_y, zero);
|
||||||
sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees
|
glRotatef(-bank, zero, zero, 1.0);
|
||||||
if( sideslip_angle < -FG_PI/9 ) {
|
|
||||||
sideslip_angle = -FG_PI/9;
|
glBegin(GL_LINES);
|
||||||
}
|
|
||||||
else
|
if( !scr_hole )
|
||||||
if( sideslip_angle > FG_PI/9 ) {
|
{
|
||||||
sideslip_angle = FG_PI/9;
|
glVertex2f( -fspan, zero );
|
||||||
}
|
glVertex2f( fspan, zero );
|
||||||
|
} else {
|
||||||
// sin_bank = sin( FG_2PI-FG_Phi );
|
glVertex2f( -fspan, zero );
|
||||||
// cos_bank = cos( FG_2PI-FG_Phi );
|
glVertex2f( -hole, zero );
|
||||||
sin_bank = sin(FG_2PI-bank_angle);
|
glVertex2f( hole, zero );
|
||||||
cos_bank = cos(FG_2PI-bank_angle);
|
glVertex2f( fspan, zero );
|
||||||
|
}
|
||||||
x_inc1 = (int)(get_span() * cos_bank);
|
// draw teemarks
|
||||||
y_inc1 = (int)(get_span() * sin_bank);
|
glVertex2f( hole, zero );
|
||||||
x_inc2 = (int)(scr_hole * cos_bank);
|
glVertex2f( hole, tee );
|
||||||
y_inc2 = (int)(scr_hole * sin_bank);
|
glVertex2f( -hole, zero );
|
||||||
|
glVertex2f( -hole, tee );
|
||||||
x_t_inc1 = (int)(tee_height * sin_bank);
|
|
||||||
y_t_inc1 = (int)(tee_height * cos_bank);
|
glEnd();
|
||||||
|
|
||||||
d_bottom_x = 0;
|
glBegin(GL_LINE_LOOP);
|
||||||
d_bottom_y = (int)(-scr_hole);
|
glVertex2f( ss_const, -hole);
|
||||||
d_right_x = (int)(scr_hole);
|
glVertex2f( ss_const + hole, zero);
|
||||||
d_right_y = 0;
|
glVertex2f( ss_const, hole);
|
||||||
d_top_x = 0;
|
glVertex2f( ss_const - hole, zero);
|
||||||
d_top_y = (int)(scr_hole);
|
glEnd();
|
||||||
d_left_x = (int)(-scr_hole);
|
|
||||||
d_left_y = 0;
|
|
||||||
|
|
||||||
ss_const = (get_span()*2)/(FG_2PI/9); // width represents 40 degrees
|
|
||||||
|
|
||||||
d_bottom_x += (int)(sideslip_angle*ss_const);
|
|
||||||
d_right_x += (int)(sideslip_angle*ss_const);
|
|
||||||
d_left_x += (int)(sideslip_angle*ss_const);
|
|
||||||
d_top_x += (int)(sideslip_angle*ss_const);
|
|
||||||
|
|
||||||
inc_b_x = (int)(d_bottom_x*cos_bank-d_bottom_y*sin_bank);
|
|
||||||
inc_b_y = (int)(d_bottom_x*sin_bank+d_bottom_y*cos_bank);
|
|
||||||
inc_r_x = (int)(d_right_x*cos_bank-d_right_y*sin_bank);
|
|
||||||
inc_r_y = (int)(d_right_x*sin_bank+d_right_y*cos_bank);
|
|
||||||
inc_t_x = (int)(d_top_x*cos_bank-d_top_y*sin_bank);
|
|
||||||
inc_t_y = (int)(d_top_x*sin_bank+d_top_y*cos_bank);
|
|
||||||
inc_l_x = (int)(d_left_x*cos_bank-d_left_y*sin_bank);
|
|
||||||
inc_l_y = (int)(d_left_x*sin_bank+d_left_y*cos_bank);
|
|
||||||
|
|
||||||
if( scr_hole == 0 )
|
|
||||||
{
|
|
||||||
drawOneLine( centroid.x - x_inc1, centroid.y - y_inc1, \
|
|
||||||
centroid.x + x_inc1, centroid.y + y_inc1 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
drawOneLine( centroid.x - x_inc1, centroid.y - y_inc1, \
|
|
||||||
centroid.x - x_inc2, centroid.y - y_inc2 );
|
|
||||||
drawOneLine( centroid.x + x_inc2, centroid.y + y_inc2, \
|
|
||||||
centroid.x + x_inc1, centroid.y + y_inc1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw teemarks
|
|
||||||
drawOneLine( centroid.x + x_inc2, \
|
|
||||||
centroid.y + y_inc2, \
|
|
||||||
centroid.x + x_inc2 + x_t_inc1, \
|
|
||||||
centroid.y + y_inc2 - y_t_inc1 );
|
|
||||||
drawOneLine( centroid.x - x_inc2, \
|
|
||||||
centroid.y - y_inc2, \
|
|
||||||
centroid.x - x_inc2 + x_t_inc1, \
|
|
||||||
centroid.y - y_inc2 - y_t_inc1 );
|
|
||||||
|
|
||||||
// draw sideslip diamond (it is not yet positioned correctly )
|
|
||||||
drawOneLine( centroid.x + inc_b_x, \
|
|
||||||
centroid.y + inc_b_y, \
|
|
||||||
centroid.x + inc_r_x, \
|
|
||||||
centroid.y + inc_r_y );
|
|
||||||
drawOneLine( centroid.x + inc_r_x, \
|
|
||||||
centroid.y + inc_r_y, \
|
|
||||||
centroid.x + inc_t_x, \
|
|
||||||
centroid.y + inc_t_y );
|
|
||||||
drawOneLine( centroid.x + inc_t_x, \
|
|
||||||
centroid.y + inc_t_y, \
|
|
||||||
centroid.x + inc_l_x, \
|
|
||||||
centroid.y + inc_l_y );
|
|
||||||
drawOneLine( centroid.x + inc_l_x, \
|
|
||||||
centroid.y + inc_l_y, \
|
|
||||||
centroid.x + inc_b_x, \
|
|
||||||
centroid.y + inc_b_y );
|
|
||||||
|
|
||||||
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -17,7 +17,7 @@
|
||||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
//
|
//
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
#define LETTER_OFFSET 0.03515625
|
#define LETTER_OFFSET 0.03515625
|
||||||
|
|
||||||
#ifndef _PANEL_HXX
|
#ifndef _PANEL_HXX
|
||||||
|
@ -43,190 +43,190 @@
|
||||||
class FGInstrument;
|
class FGInstrument;
|
||||||
|
|
||||||
class FGPanel{
|
class FGPanel{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int height, width;
|
int height, width;
|
||||||
GLuint FontList;
|
GLuint FontList;
|
||||||
|
|
||||||
GLubyte *background;
|
GLubyte *background;
|
||||||
|
|
||||||
// FGInstrument **instr_list;
|
// FGInstrument **instr_list;
|
||||||
FGInstrument *test_instr[7];
|
FGInstrument *test_instr[7];
|
||||||
|
|
||||||
void GetData(void);
|
void GetData(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static FGPanel *OurPanel;
|
static FGPanel *OurPanel;
|
||||||
|
|
||||||
FGPanel(void);
|
FGPanel(void);
|
||||||
|
|
||||||
float get_height(void){
|
float get_height(void){
|
||||||
return height;
|
return height;
|
||||||
}
|
|
||||||
|
|
||||||
void ReInit( int x, int y, int finx, int finy);
|
|
||||||
void Update(void);
|
|
||||||
|
|
||||||
void DrawLetter(void){
|
|
||||||
glBegin(GL_POLYGON);
|
|
||||||
glTexCoord2f(0.0, 0.0);
|
|
||||||
glVertex2f(0.0, 0.0);
|
|
||||||
glTexCoord2f(LETTER_OFFSET + 0.004, 0.0);
|
|
||||||
glVertex2f(7.0, 0.0);
|
|
||||||
glTexCoord2f(LETTER_OFFSET + 0.004, 0.0390625);
|
|
||||||
glVertex2f(7.0, 9.0);
|
|
||||||
glTexCoord2f(0.0, 0.0390625);
|
|
||||||
glVertex2f(0.0, 9.0);
|
|
||||||
glEnd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawTestLetter(float X, float Y);
|
void ReInit( int x, int y, int finx, int finy);
|
||||||
void InitLists(void);
|
void Update(void);
|
||||||
void TexString(char *s, float XPos, float YPos, float size);
|
|
||||||
|
void DrawLetter(void){
|
||||||
|
glBegin(GL_POLYGON);
|
||||||
|
glTexCoord2f(0.0, 0.0);
|
||||||
|
glVertex2f(0.0, 0.0);
|
||||||
|
glTexCoord2f(LETTER_OFFSET + 0.004, 0.0);
|
||||||
|
glVertex2f(7.0, 0.0);
|
||||||
|
glTexCoord2f(LETTER_OFFSET + 0.004, 0.0390625);
|
||||||
|
glVertex2f(7.0, 9.0);
|
||||||
|
glTexCoord2f(0.0, 0.0390625);
|
||||||
|
glVertex2f(0.0, 9.0);
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawTestLetter(float X, float Y);
|
||||||
|
void InitLists(void);
|
||||||
|
void TexString(char *s, float XPos, float YPos, float size);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGInstrument{
|
class FGInstrument{
|
||||||
friend class FGPanel;
|
friend class FGPanel;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float XPos, YPos;
|
float XPos, YPos;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FGInstrument(void){
|
FGInstrument(void){
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~FGInstrument(void){}
|
virtual ~FGInstrument(void){}
|
||||||
|
|
||||||
virtual void Init(void) = 0;
|
virtual void Init(void) = 0;
|
||||||
virtual void Render(void) = 0;
|
virtual void Render(void) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGHorizon : public FGInstrument {
|
class FGHorizon : public FGInstrument {
|
||||||
private:
|
private:
|
||||||
float texXPos;
|
float texXPos;
|
||||||
float texYPos;
|
float texYPos;
|
||||||
float radius;
|
float radius;
|
||||||
float bottom; // tell the program the offset between midpoint and bottom
|
float bottom; // tell the program the offset between midpoint and bottom
|
||||||
float top; // guess what ;-)
|
float top; // guess what ;-)
|
||||||
float vertices[180][2];
|
float vertices[180][2];
|
||||||
float normals[180][3];
|
float normals[180][3];
|
||||||
float texCoord[180][2];
|
float texCoord[180][2];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FGHorizon(void){
|
FGHorizon(void){
|
||||||
XPos = 0.0; YPos = 0.0;
|
XPos = 0.0; YPos = 0.0;
|
||||||
Init();
|
Init();
|
||||||
}
|
|
||||||
|
|
||||||
FGHorizon(float inXPos, float inYPos){
|
|
||||||
XPos = inXPos; YPos = inYPos;
|
|
||||||
Init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Init(void);
|
FGHorizon(float inXPos, float inYPos){
|
||||||
virtual void Render(void);
|
XPos = inXPos; YPos = inYPos;
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Init(void);
|
||||||
|
virtual void Render(void);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGTurnCoordinator : public FGInstrument {
|
class FGTurnCoordinator : public FGInstrument {
|
||||||
private:
|
private:
|
||||||
float PlaneTexXPos;
|
float PlaneTexXPos;
|
||||||
float PlaneTexYPos;
|
float PlaneTexYPos;
|
||||||
float alpha;
|
float alpha;
|
||||||
float PlaneAlpha;
|
float PlaneAlpha;
|
||||||
float alphahist[2];
|
float alphahist[2];
|
||||||
float rollhist[2];
|
float rollhist[2];
|
||||||
float BallXPos;
|
float BallXPos;
|
||||||
float BallYPos;
|
float BallYPos;
|
||||||
float BallTexXPos;
|
float BallTexXPos;
|
||||||
float BallTexYPos;
|
float BallTexYPos;
|
||||||
float BallRadius;
|
float BallRadius;
|
||||||
GLfloat vertices[72];
|
GLfloat vertices[72];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FGTurnCoordinator(void){
|
FGTurnCoordinator(void){
|
||||||
XPos = 0.0; YPos = 0.0;
|
XPos = 0.0; YPos = 0.0;
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
FGTurnCoordinator(float inXPos, float inYPos){
|
FGTurnCoordinator(float inXPos, float inYPos){
|
||||||
XPos = inXPos; YPos = inYPos;
|
XPos = inXPos; YPos = inYPos;
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Init (void);
|
virtual void Init (void);
|
||||||
virtual void Render(void);
|
virtual void Render(void);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGRpmGauge : public FGInstrument {
|
class FGRpmGauge : public FGInstrument {
|
||||||
private:
|
private:
|
||||||
GLuint list;
|
GLuint list;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FGRpmGauge(void){
|
FGRpmGauge(void){
|
||||||
XPos = 0.0; YPos = 0.0;
|
XPos = 0.0; YPos = 0.0;
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
FGRpmGauge(float inXPos, float inYPos){
|
FGRpmGauge(float inXPos, float inYPos){
|
||||||
XPos = inXPos; YPos = inYPos;
|
XPos = inXPos; YPos = inYPos;
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Init(void);
|
virtual void Init(void);
|
||||||
virtual void Render(void);
|
virtual void Render(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
// temporary class until I get the software-only routines for the
|
// temporary class until I get the software-only routines for the
|
||||||
// instruments run
|
// instruments run
|
||||||
|
|
||||||
class FGTexInstrument : public FGInstrument {
|
class FGTexInstrument : public FGInstrument {
|
||||||
|
|
||||||
private:
|
|
||||||
float radius;
|
|
||||||
float length;
|
|
||||||
float width;
|
|
||||||
float angle;
|
|
||||||
float tape[2];
|
|
||||||
float value1;
|
|
||||||
float value2;
|
|
||||||
float alpha1;
|
|
||||||
float alpha2;
|
|
||||||
float teXpos;
|
|
||||||
float texYpos;
|
|
||||||
int variable;
|
|
||||||
GLfloat vertices[20];
|
|
||||||
|
|
||||||
public:
|
private:
|
||||||
FGTexInstrument(void){
|
float radius;
|
||||||
XPos = 0.0; YPos = 0.0;
|
float length;
|
||||||
Init();
|
float width;
|
||||||
}
|
float angle;
|
||||||
|
float tape[2];
|
||||||
FGTexInstrument(float inXPos, float inYPos, float inradius, float inlength, float inwidth, float inangle, float invalue1, float invalue2, float inalpha1, float inalpha2, float intexXPos, float intexYPos, int invariable){
|
float value1;
|
||||||
|
float value2;
|
||||||
XPos = inXPos; YPos = inYPos;
|
float alpha1;
|
||||||
radius = inradius; angle = inangle;
|
float alpha2;
|
||||||
length = inlength; width = inwidth;
|
float teXpos;
|
||||||
value1 = invalue1; value2 = invalue2;
|
float texYpos;
|
||||||
alpha1 = inalpha1; alpha2 = inalpha2;
|
int variable;
|
||||||
teXpos = intexXPos; texYpos = intexYPos;
|
GLfloat vertices[20];
|
||||||
variable = invariable;
|
|
||||||
Init();
|
public:
|
||||||
}
|
FGTexInstrument(void){
|
||||||
|
XPos = 0.0; YPos = 0.0;
|
||||||
void CreatePointer(void);
|
Init();
|
||||||
void UpdatePointer(void);
|
}
|
||||||
|
|
||||||
void Init(void);
|
FGTexInstrument(float inXPos, float inYPos, float inradius, float inlength, float inwidth, float inangle, float invalue1, float invalue2, float inalpha1, float inalpha2, float intexXPos, float intexYPos, int invariable){
|
||||||
void Render(void);
|
|
||||||
|
XPos = inXPos; YPos = inYPos;
|
||||||
|
radius = inradius; angle = inangle;
|
||||||
|
length = inlength; width = inwidth;
|
||||||
|
value1 = invalue1; value2 = invalue2;
|
||||||
|
alpha1 = inalpha1; alpha2 = inalpha2;
|
||||||
|
teXpos = intexXPos; texYpos = intexYPos;
|
||||||
|
variable = invariable;
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreatePointer(void);
|
||||||
|
void UpdatePointer(void);
|
||||||
|
|
||||||
|
void Init(void);
|
||||||
|
void Render(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
float XPos;
|
float XPos;
|
||||||
float YPos;
|
float YPos;
|
||||||
float radius;
|
float radius;
|
||||||
float length;
|
float length;
|
||||||
float width;
|
float width;
|
||||||
|
@ -249,6 +249,3 @@ void DrawBeechcraftLogo(float XPos, float YPos, float Width, float Height);
|
||||||
void PrintMatrix( void);
|
void PrintMatrix( void);
|
||||||
|
|
||||||
#endif // _PANEL_HXX
|
#endif // _PANEL_HXX
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue