Integrated Charlies latest HUD updates.
Wrote access functions for current fgOPTIONS.
This commit is contained in:
parent
4abe562805
commit
8f3c1f30e1
10 changed files with 365 additions and 235 deletions
|
@ -215,29 +215,25 @@ double get_sideslip( void )
|
||||||
|
|
||||||
double get_frame_rate( void )
|
double get_frame_rate( void )
|
||||||
{
|
{
|
||||||
fgGENERAL *g;
|
fgGENERAL *pgeneral;
|
||||||
|
|
||||||
g = &general;
|
pgeneral = &general;
|
||||||
|
|
||||||
return g->frame_rate;
|
return pgeneral->frame_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
double get_fov( void )
|
double get_fov( void )
|
||||||
{
|
{
|
||||||
fgOPTIONS *o;
|
return (current_options.get_fov());
|
||||||
|
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
return o->fov;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double get_vfc_ratio( void )
|
double get_vfc_ratio( void )
|
||||||
{
|
{
|
||||||
fgVIEW *v;
|
fgVIEW *pview;
|
||||||
|
|
||||||
v = ¤t_view;
|
pview = ¤t_view;
|
||||||
|
|
||||||
return v->vfc_ratio;
|
return pview->vfc_ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
|
bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
|
||||||
|
@ -270,32 +266,35 @@ bool fgCockpitInit( fgAIRCRAFT *cur_aircraft )
|
||||||
|
|
||||||
|
|
||||||
void fgCockpitUpdate( void ) {
|
void fgCockpitUpdate( void ) {
|
||||||
fgOPTIONS *o;
|
fgVIEW *pview;
|
||||||
fgVIEW *v;
|
|
||||||
|
|
||||||
o = ¤t_options;
|
pview = ¤t_view;
|
||||||
v = ¤t_view;
|
|
||||||
|
|
||||||
fgPrintf( FG_COCKPIT, FG_DEBUG,
|
fgPrintf( FG_COCKPIT, FG_DEBUG,
|
||||||
"Cockpit: code %d status %d\n",
|
"Cockpit: code %d status %d\n",
|
||||||
ac_cockpit->code(), ac_cockpit->status() );
|
ac_cockpit->code(), ac_cockpit->status() );
|
||||||
|
|
||||||
if ( o->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();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( o->panel_status && (fabs(v->view_offset) < 0.2) ) {
|
if ( current_options.get_panel_status() &&
|
||||||
|
(fabs(pview->view_offset) < 0.2) ) {
|
||||||
fgPanelUpdate();
|
fgPanelUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.10 1998/07/08 14:41:08 curt
|
/* Revision 1.11 1998/07/13 21:00:45 curt
|
||||||
/* Renamed polar3d.h to polar3d.hxx
|
/* Integrated Charlies latest HUD updates.
|
||||||
|
/* Wrote access functions for current fgOPTIONS.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.10 1998/07/08 14:41:08 curt
|
||||||
|
* Renamed polar3d.h to polar3d.hxx
|
||||||
|
*
|
||||||
* Revision 1.9 1998/06/27 16:47:53 curt
|
* Revision 1.9 1998/06/27 16:47:53 curt
|
||||||
* Incorporated Friedemann Reinhard's <mpt218@faupt212.physik.uni-erlangen.de>
|
* Incorporated Friedemann Reinhard's <mpt218@faupt212.physik.uni-erlangen.de>
|
||||||
* first pass at an isntrument panel.
|
* first pass at an isntrument panel.
|
||||||
|
|
|
@ -28,25 +28,14 @@
|
||||||
#define _COCKPIT_HXX
|
#define _COCKPIT_HXX
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
# error This library requires C++
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "hud.hxx"
|
#include "hud.hxx"
|
||||||
#include "panel.hxx"
|
#include "panel.hxx"
|
||||||
|
|
||||||
|
|
||||||
#ifndef __cplusplus
|
|
||||||
# error This library requires C++
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//typedef struct {
|
|
||||||
// int code;
|
|
||||||
// Hptr hud;
|
|
||||||
// // As above.
|
|
||||||
// // PANEL *panel;
|
|
||||||
// int status;
|
|
||||||
//}fgCOCKPIT, *pfgCockpit;
|
|
||||||
|
|
||||||
// And in the future (near future i hope).
|
|
||||||
// #include <Cockpit/panel.h>
|
|
||||||
// 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 {
|
||||||
|
@ -71,10 +60,14 @@ void fgCockpitUpdate( void );
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.3 1998/06/27 16:47:54 curt
|
/* Revision 1.4 1998/07/13 21:00:46 curt
|
||||||
/* Incorporated Friedemann Reinhard's <mpt218@faupt212.physik.uni-erlangen.de>
|
/* Integrated Charlies latest HUD updates.
|
||||||
/* first pass at an isntrument panel.
|
/* Wrote access functions for current fgOPTIONS.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.3 1998/06/27 16:47:54 curt
|
||||||
|
* Incorporated Friedemann Reinhard's <mpt218@faupt212.physik.uni-erlangen.de>
|
||||||
|
* first pass at an isntrument panel.
|
||||||
|
*
|
||||||
* Revision 1.2 1998/05/11 18:13:10 curt
|
* Revision 1.2 1998/05/11 18:13:10 curt
|
||||||
* Complete C++ rewrite of all cockpit code by Charlie Hotchkiss.
|
* Complete C++ rewrite of all cockpit code by Charlie Hotchkiss.
|
||||||
*
|
*
|
||||||
|
|
368
Cockpit/hud.cxx
368
Cockpit/hud.cxx
|
@ -43,6 +43,7 @@
|
||||||
#include <Aircraft/aircraft.h>
|
#include <Aircraft/aircraft.h>
|
||||||
#include <Debug/fg_debug.h>
|
#include <Debug/fg_debug.h>
|
||||||
#include <Include/fg_constants.h>
|
#include <Include/fg_constants.h>
|
||||||
|
#include <Main/options.hxx>
|
||||||
#include <Math/fg_random.h>
|
#include <Math/fg_random.h>
|
||||||
#include <Math/mat3.h>
|
#include <Math/mat3.h>
|
||||||
#include <Math/polar3d.hxx>
|
#include <Math/polar3d.hxx>
|
||||||
|
@ -169,17 +170,17 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
do {
|
do {
|
||||||
switch ( index ) {
|
switch ( index ) {
|
||||||
case 0: // TBI
|
case 0: // TBI
|
||||||
HIptr = (instr_item *) new fgTBI_instr( 300, 100, 60, 10 );
|
HIptr = (instr_item *) new fgTBI_instr( 270, 100, 60, 10 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // Artificial Horizon
|
case 1: // Artificial Horizon
|
||||||
HIptr = (instr_item *) new HudLadder( 270, 195, 120, 180 );
|
HIptr = (instr_item *) new HudLadder( 240, 195, 120, 180 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // KIAS
|
case 2: // KIAS
|
||||||
HIptr = (instr_item *) new hud_card( 160,
|
HIptr = (instr_item *) new hud_card( 130,
|
||||||
170,
|
170,
|
||||||
35,
|
28,
|
||||||
200,
|
200,
|
||||||
get_speed,
|
get_speed,
|
||||||
HUDS_LEFT | HUDS_VERT,
|
HUDS_LEFT | HUDS_VERT,
|
||||||
|
@ -194,39 +195,39 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // Angle of Attack
|
case 3: // Angle of Attack
|
||||||
HIptr = (instr_item *) new hud_card( 450,
|
HIptr = (instr_item *) new hud_card( 420,
|
||||||
195,
|
195,
|
||||||
30,
|
25,
|
||||||
150,
|
150,
|
||||||
get_aoa,
|
get_aoa,
|
||||||
HUDS_LEFT | HUDS_VERT,
|
HUDS_LEFT | HUDS_VERT,
|
||||||
50, -40,
|
50, -40,
|
||||||
1.0,
|
1.0,
|
||||||
5, 1,
|
2, 1,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
21.0,
|
5.0,
|
||||||
true);
|
true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // GYRO COMPASS
|
case 4: // GYRO COMPASS
|
||||||
HIptr = (instr_item *) new hud_card( 200,
|
HIptr = (instr_item *) new hud_card( 200,
|
||||||
375,
|
375,
|
||||||
260,
|
200,
|
||||||
32,
|
28,
|
||||||
get_heading,
|
get_heading,
|
||||||
HUDS_TOP,
|
HUDS_TOP,
|
||||||
360, 0,
|
360, 0,
|
||||||
1.0,
|
1.0,
|
||||||
10, 5,
|
5, 1,
|
||||||
360,
|
360,
|
||||||
0,
|
0,
|
||||||
50,
|
25,
|
||||||
true);
|
true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: // AMSL
|
case 5: // AMSL
|
||||||
HIptr = (instr_item *) new hud_card( 490,
|
HIptr = (instr_item *) new hud_card( 460,
|
||||||
170,
|
170,
|
||||||
35,
|
35,
|
||||||
200,
|
200,
|
||||||
|
@ -241,8 +242,56 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
true);
|
true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: // Digital KIAS
|
case 6:
|
||||||
HIptr = (instr_item *) new instr_label ( 160,
|
HIptr = (instr_item *) new guage_instr( 250, // x
|
||||||
|
350, // y
|
||||||
|
100, // width
|
||||||
|
20, // height
|
||||||
|
get_aileronval, // data source
|
||||||
|
HUDS_BOTTOM | HUDS_NOTEXT,
|
||||||
|
100.0,
|
||||||
|
+1.0,
|
||||||
|
-1.0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7:
|
||||||
|
HIptr = (instr_item *) new guage_instr( 170, // x
|
||||||
|
225, // y
|
||||||
|
20, // width
|
||||||
|
100, // height
|
||||||
|
get_elevatorval, // data source
|
||||||
|
HUDS_RIGHT | HUDS_VERT | HUDS_NOTEXT,
|
||||||
|
-100.0, // Scale data
|
||||||
|
+1.0, // Data Range
|
||||||
|
-1.0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
HIptr = (instr_item *) new guage_instr( 250, // x
|
||||||
|
200, // y
|
||||||
|
100, // width
|
||||||
|
20, // height
|
||||||
|
get_rudderval, // data source
|
||||||
|
HUDS_TOP | HUDS_NOTEXT,
|
||||||
|
100.0,
|
||||||
|
+1.0,
|
||||||
|
-1.0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
HIptr = (instr_item *) new guage_instr( 100, // x
|
||||||
|
190,
|
||||||
|
20,
|
||||||
|
160, // height
|
||||||
|
get_throttleval, // data source
|
||||||
|
HUDS_VERT | HUDS_RIGHT | HUDS_NOTEXT,
|
||||||
|
100.0,
|
||||||
|
1.0,
|
||||||
|
0.0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 10: // Digital KIAS
|
||||||
|
HIptr = (instr_item *) new instr_label ( 110,
|
||||||
150,
|
150,
|
||||||
40,
|
40,
|
||||||
30,
|
30,
|
||||||
|
@ -250,6 +299,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
"%5.0f",
|
"%5.0f",
|
||||||
NULL,
|
NULL,
|
||||||
" Kts",
|
" Kts",
|
||||||
|
1.0,
|
||||||
HUDS_TOP,
|
HUDS_TOP,
|
||||||
RIGHT_JUST,
|
RIGHT_JUST,
|
||||||
SMALL,
|
SMALL,
|
||||||
|
@ -257,8 +307,8 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
TRUE );
|
TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7: // Digital Altimeter
|
case 11: // Digital Altimeter
|
||||||
HIptr = (instr_item *) new instr_label ( 160,
|
HIptr = (instr_item *) new instr_label ( 110,
|
||||||
135,
|
135,
|
||||||
40,
|
40,
|
||||||
10,
|
10,
|
||||||
|
@ -266,6 +316,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
"MSL %5.0f",
|
"MSL %5.0f",
|
||||||
NULL,
|
NULL,
|
||||||
" m",
|
" m",
|
||||||
|
1.0,
|
||||||
HUDS_TOP,
|
HUDS_TOP,
|
||||||
LEFT_JUST,
|
LEFT_JUST,
|
||||||
SMALL,
|
SMALL,
|
||||||
|
@ -273,8 +324,8 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
TRUE );
|
TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8: // Roll indication diagnostic
|
case 12: // Roll indication diagnostic
|
||||||
HIptr = (instr_item *) new instr_label ( 160,
|
HIptr = (instr_item *) new instr_label ( 110,
|
||||||
120,
|
120,
|
||||||
40,
|
40,
|
||||||
10,
|
10,
|
||||||
|
@ -282,6 +333,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
"%5.2f",
|
"%5.2f",
|
||||||
" Roll",
|
" Roll",
|
||||||
" Deg",
|
" Deg",
|
||||||
|
1.0,
|
||||||
HUDS_TOP,
|
HUDS_TOP,
|
||||||
RIGHT_JUST,
|
RIGHT_JUST,
|
||||||
SMALL,
|
SMALL,
|
||||||
|
@ -289,7 +341,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
TRUE );
|
TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9: // Angle of attack diagnostic
|
case 13: // Angle of attack diagnostic
|
||||||
HIptr = (instr_item *) new instr_label ( 440,
|
HIptr = (instr_item *) new instr_label ( 440,
|
||||||
150,
|
150,
|
||||||
60,
|
60,
|
||||||
|
@ -298,6 +350,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
" %5.2f",
|
" %5.2f",
|
||||||
"AOA",
|
"AOA",
|
||||||
" Deg",
|
" Deg",
|
||||||
|
1.0,
|
||||||
HUDS_TOP,
|
HUDS_TOP,
|
||||||
RIGHT_JUST,
|
RIGHT_JUST,
|
||||||
SMALL,
|
SMALL,
|
||||||
|
@ -305,15 +358,16 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
TRUE );
|
TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 10:
|
case 14:
|
||||||
HIptr = (instr_item *) new instr_label ( 440,
|
HIptr = (instr_item *) new instr_label ( 440,
|
||||||
135,
|
135,
|
||||||
60,
|
60,
|
||||||
10,
|
10,
|
||||||
get_heading,
|
get_heading,
|
||||||
" %5.0f",
|
" %5.1f",
|
||||||
"Heading ",
|
"Heading ",
|
||||||
" Deg",
|
" Deg",
|
||||||
|
1.0,
|
||||||
HUDS_TOP,
|
HUDS_TOP,
|
||||||
RIGHT_JUST,
|
RIGHT_JUST,
|
||||||
SMALL,
|
SMALL,
|
||||||
|
@ -321,7 +375,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
TRUE );
|
TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 11:
|
case 15:
|
||||||
HIptr = (instr_item *) new instr_label ( 440,
|
HIptr = (instr_item *) new instr_label ( 440,
|
||||||
120,
|
120,
|
||||||
60,
|
60,
|
||||||
|
@ -330,6 +384,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
"%5.2f",
|
"%5.2f",
|
||||||
"Sideslip ",
|
"Sideslip ",
|
||||||
NULL,
|
NULL,
|
||||||
|
1.0,
|
||||||
HUDS_TOP,
|
HUDS_TOP,
|
||||||
RIGHT_JUST,
|
RIGHT_JUST,
|
||||||
SMALL,
|
SMALL,
|
||||||
|
@ -337,7 +392,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
TRUE );
|
TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 12:
|
case 16:
|
||||||
HIptr = (instr_item *) new instr_label( 440,
|
HIptr = (instr_item *) new instr_label( 440,
|
||||||
100,
|
100,
|
||||||
60,
|
60,
|
||||||
|
@ -346,71 +401,7 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
"%5.2f",
|
"%5.2f",
|
||||||
"Throttle ",
|
"Throttle ",
|
||||||
NULL,
|
NULL,
|
||||||
HUDS_TOP,
|
1.0,
|
||||||
RIGHT_JUST,
|
|
||||||
SMALL,
|
|
||||||
0,
|
|
||||||
TRUE );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 13:
|
|
||||||
HIptr = (instr_item *) new instr_label( 440,
|
|
||||||
85,
|
|
||||||
60,
|
|
||||||
10,
|
|
||||||
get_elevatorval,
|
|
||||||
"%5.2f",
|
|
||||||
"Elevator ",
|
|
||||||
NULL,
|
|
||||||
HUDS_TOP,
|
|
||||||
RIGHT_JUST,
|
|
||||||
SMALL,
|
|
||||||
0,
|
|
||||||
TRUE );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 14:
|
|
||||||
HIptr = (instr_item *) new instr_label( 440,
|
|
||||||
60,
|
|
||||||
60,
|
|
||||||
10,
|
|
||||||
get_aileronval,
|
|
||||||
"%5.2f",
|
|
||||||
"Aileron ",
|
|
||||||
NULL,
|
|
||||||
HUDS_TOP,
|
|
||||||
RIGHT_JUST,
|
|
||||||
SMALL,
|
|
||||||
0,
|
|
||||||
TRUE );
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
case 15:
|
|
||||||
HIptr = (instr_item *) new instr_label( 10,
|
|
||||||
10,
|
|
||||||
60,
|
|
||||||
10,
|
|
||||||
get_frame_rate,
|
|
||||||
"%.1f",
|
|
||||||
"Frame rate = ",
|
|
||||||
NULL,
|
|
||||||
HUDS_TOP,
|
|
||||||
RIGHT_JUST,
|
|
||||||
SMALL,
|
|
||||||
0,
|
|
||||||
TRUE );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 16:
|
|
||||||
HIptr = (instr_item *) new instr_label( 10,
|
|
||||||
25,
|
|
||||||
90,
|
|
||||||
10,
|
|
||||||
get_vfc_ratio,
|
|
||||||
"%.2f",
|
|
||||||
"VFC Ratio = ",
|
|
||||||
NULL,
|
|
||||||
HUDS_TOP,
|
HUDS_TOP,
|
||||||
RIGHT_JUST,
|
RIGHT_JUST,
|
||||||
SMALL,
|
SMALL,
|
||||||
|
@ -419,6 +410,75 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 17:
|
case 17:
|
||||||
|
HIptr = (instr_item *) new instr_label( 440,
|
||||||
|
85,
|
||||||
|
60,
|
||||||
|
10,
|
||||||
|
get_elevatorval,
|
||||||
|
"%5.2f",
|
||||||
|
"Elevator ",
|
||||||
|
NULL,
|
||||||
|
1.0,
|
||||||
|
HUDS_TOP,
|
||||||
|
RIGHT_JUST,
|
||||||
|
SMALL,
|
||||||
|
0,
|
||||||
|
TRUE );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 18:
|
||||||
|
HIptr = (instr_item *) new instr_label( 440,
|
||||||
|
60,
|
||||||
|
60,
|
||||||
|
10,
|
||||||
|
get_aileronval,
|
||||||
|
"%5.2f",
|
||||||
|
"Aileron ",
|
||||||
|
NULL,
|
||||||
|
1.0,
|
||||||
|
HUDS_TOP,
|
||||||
|
RIGHT_JUST,
|
||||||
|
SMALL,
|
||||||
|
0,
|
||||||
|
TRUE );
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case 19:
|
||||||
|
HIptr = (instr_item *) new instr_label( 10,
|
||||||
|
10,
|
||||||
|
60,
|
||||||
|
10,
|
||||||
|
get_frame_rate,
|
||||||
|
"%.1f",
|
||||||
|
"Frame rate = ",
|
||||||
|
NULL,
|
||||||
|
1.0,
|
||||||
|
HUDS_TOP,
|
||||||
|
RIGHT_JUST,
|
||||||
|
SMALL,
|
||||||
|
0,
|
||||||
|
TRUE );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 20:
|
||||||
|
HIptr = (instr_item *) new instr_label( 10,
|
||||||
|
25,
|
||||||
|
90,
|
||||||
|
10,
|
||||||
|
get_vfc_ratio,
|
||||||
|
"%.2f",
|
||||||
|
"VFC Ratio = ",
|
||||||
|
NULL,
|
||||||
|
1.0,
|
||||||
|
HUDS_TOP,
|
||||||
|
RIGHT_JUST,
|
||||||
|
SMALL,
|
||||||
|
0,
|
||||||
|
TRUE );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 21:
|
||||||
HIptr = (instr_item *) new instr_label( 10,
|
HIptr = (instr_item *) new instr_label( 10,
|
||||||
40,
|
40,
|
||||||
90,
|
90,
|
||||||
|
@ -427,47 +487,13 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
"%.1f",
|
"%.1f",
|
||||||
"FOV = ",
|
"FOV = ",
|
||||||
NULL,
|
NULL,
|
||||||
|
1.0,
|
||||||
HUDS_TOP,
|
HUDS_TOP,
|
||||||
RIGHT_JUST,
|
RIGHT_JUST,
|
||||||
SMALL,
|
SMALL,
|
||||||
0,
|
0,
|
||||||
TRUE );
|
TRUE );
|
||||||
break;
|
break;
|
||||||
case 18:
|
|
||||||
HIptr = (instr_item *) new guage_instr( 50, // x
|
|
||||||
200, // y
|
|
||||||
100, // width
|
|
||||||
20, // height
|
|
||||||
get_aileronval, // data source
|
|
||||||
HUDS_BOTTOM,
|
|
||||||
100.0,
|
|
||||||
+1.0,
|
|
||||||
-1.0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 19:
|
|
||||||
HIptr = (instr_item *) new guage_instr( 90, // x
|
|
||||||
225, // y
|
|
||||||
20, // width
|
|
||||||
100, // height
|
|
||||||
get_elevatorval, // data source
|
|
||||||
HUDS_BOTH | HUDS_VERT,
|
|
||||||
100.0, // Scale data
|
|
||||||
+1.0, // Data Range
|
|
||||||
-1.0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 20:
|
|
||||||
HIptr = (instr_item *) new guage_instr( 50, // x
|
|
||||||
350, // y
|
|
||||||
100, // width
|
|
||||||
20, // height
|
|
||||||
get_rudderval, // data source
|
|
||||||
HUDS_TOP,
|
|
||||||
100.0,
|
|
||||||
+1.0,
|
|
||||||
-1.0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
HIptr = 0;;
|
HIptr = 0;;
|
||||||
|
@ -482,6 +508,79 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
return 0; // For now. Later we may use this for an error code.
|
return 0; // For now. Later we may use this for an error code.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int global_day_night_switch = DAY;
|
||||||
|
|
||||||
|
void HUD_brightkey( bool incr_bright )
|
||||||
|
{
|
||||||
|
instr_item *pHUDInstr = HUD_deque[0];
|
||||||
|
int brightness = pHUDInstr->get_brightness();
|
||||||
|
|
||||||
|
if( current_options.get_hud_status() ) {
|
||||||
|
if( incr_bright ) {
|
||||||
|
switch (brightness) {
|
||||||
|
case BRT_LIGHT:
|
||||||
|
current_options.set_hud_status(0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BRT_MEDIUM:
|
||||||
|
brightness = BRT_LIGHT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BRT_DARK:
|
||||||
|
brightness = BRT_MEDIUM;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BRT_BLACK:
|
||||||
|
brightness = BRT_DARK;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
brightness = BRT_BLACK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (brightness) {
|
||||||
|
case BRT_LIGHT:
|
||||||
|
brightness = BRT_MEDIUM;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BRT_MEDIUM:
|
||||||
|
brightness = BRT_DARK;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BRT_DARK:
|
||||||
|
brightness = BRT_BLACK;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BRT_BLACK:
|
||||||
|
default:
|
||||||
|
current_options.set_hud_status(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
current_options.set_hud_status(1);
|
||||||
|
if( incr_bright ) {
|
||||||
|
if( DAY == global_day_night_switch ) {
|
||||||
|
brightness = BRT_BLACK;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
brightness = BRT_DARK;
|
||||||
|
global_day_night_switch = DAY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if( NIGHT == global_day_night_switch ) {
|
||||||
|
brightness = BRT_DARK;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
brightness = BRT_MEDIUM;
|
||||||
|
global_day_night_switch = NIGHT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pHUDInstr->SetBrightness( brightness );
|
||||||
|
}
|
||||||
|
|
||||||
// fgUpdateHUD
|
// fgUpdateHUD
|
||||||
//
|
//
|
||||||
|
@ -489,8 +588,6 @@ int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ )
|
||||||
// the HUD object with requests for redraw. Kinda. It will when this is
|
// the HUD object with requests for redraw. Kinda. It will when this is
|
||||||
// all C++.
|
// all C++.
|
||||||
//
|
//
|
||||||
int global_day_night_switch = DAY;
|
|
||||||
|
|
||||||
void fgUpdateHUD( void ) {
|
void fgUpdateHUD( void ) {
|
||||||
int i;
|
int i;
|
||||||
int brightness;
|
int brightness;
|
||||||
|
@ -543,6 +640,13 @@ void fgUpdateHUD( void ) {
|
||||||
|
|
||||||
case BRT_DARK:
|
case BRT_DARK:
|
||||||
glColor3f (0.0, 0.5, 0.0);
|
glColor3f (0.0, 0.5, 0.0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BRT_BLACK:
|
||||||
|
glColor3f( 0.0, 0.0, 0.0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -582,9 +686,13 @@ void fgUpdateHUD( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.15 1998/07/08 14:41:08 curt
|
/* Revision 1.16 1998/07/13 21:00:47 curt
|
||||||
/* Renamed polar3d.h to polar3d.hxx
|
/* Integrated Charlies latest HUD updates.
|
||||||
|
/* Wrote access functions for current fgOPTIONS.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.15 1998/07/08 14:41:08 curt
|
||||||
|
* Renamed polar3d.h to polar3d.hxx
|
||||||
|
*
|
||||||
* Revision 1.14 1998/07/06 21:31:20 curt
|
* Revision 1.14 1998/07/06 21:31:20 curt
|
||||||
* Removed an extraneous ^M.
|
* Removed an extraneous ^M.
|
||||||
*
|
*
|
||||||
|
|
|
@ -79,11 +79,12 @@ enum VIEW_MODES{ HUD_VIEW, PANEL_VIEW, CHASE_VIEW, TOWER_VIEW };
|
||||||
// Hud general constants
|
// Hud general constants
|
||||||
#define DAY 1
|
#define DAY 1
|
||||||
#define NIGHT 2
|
#define NIGHT 2
|
||||||
#define BRT_DARK 3
|
#define BRT_BLACK 3
|
||||||
#define BRT_MEDIUM 4
|
#define BRT_DARK 4
|
||||||
#define BRT_LIGHT 5
|
#define BRT_MEDIUM 5
|
||||||
#define SIZE_SMALL 6
|
#define BRT_LIGHT 6
|
||||||
#define SIZE_LARGE 7
|
#define SIZE_SMALL 7
|
||||||
|
#define SIZE_LARGE 8
|
||||||
|
|
||||||
// Label constants
|
// Label constants
|
||||||
#define SMALL 1
|
#define SMALL 1
|
||||||
|
@ -185,19 +186,28 @@ enum hudinstype{ HUDno_instr,
|
||||||
HUDtbi
|
HUDtbi
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct gltagRGBTRIPLE { // rgbt
|
||||||
|
GLfloat Blue;
|
||||||
|
GLfloat Green;
|
||||||
|
GLfloat Red;
|
||||||
|
} glRGBTRIPLE;
|
||||||
|
|
||||||
class instr_item { // An Abstract Base Class (ABC)
|
class instr_item { // An Abstract Base Class (ABC)
|
||||||
private:
|
private:
|
||||||
static UINT instances; // More than 64K instruments? Nah!
|
static UINT instances; // More than 64K instruments? Nah!
|
||||||
UINT handle;
|
static int brightness;
|
||||||
RECT scrn_pos; // Framing - affects scale dimensions
|
static glRGBTRIPLE color;
|
||||||
|
|
||||||
|
UINT handle;
|
||||||
|
RECT scrn_pos; // Framing - affects scale dimensions
|
||||||
// and orientation. Vert vs Horz, etc.
|
// and orientation. Vert vs Horz, etc.
|
||||||
DBLFNPTR load_value_fn;
|
DBLFNPTR load_value_fn;
|
||||||
UINT opts;
|
double disp_factor; // Multiply by to get numbers shown on scale.
|
||||||
bool is_enabled;
|
UINT opts;
|
||||||
bool broken;
|
bool is_enabled;
|
||||||
int brightness;
|
bool broken;
|
||||||
UINT scr_span; // Working values for draw;
|
UINT scr_span; // Working values for draw;
|
||||||
POINT mid_span; //
|
POINT mid_span; //
|
||||||
|
|
||||||
public:
|
public:
|
||||||
instr_item( int x,
|
instr_item( int x,
|
||||||
|
@ -205,6 +215,7 @@ class instr_item { // An Abstract Base Class (ABC)
|
||||||
UINT height,
|
UINT height,
|
||||||
UINT width,
|
UINT width,
|
||||||
DBLFNPTR data_source,
|
DBLFNPTR data_source,
|
||||||
|
double data_scaling,
|
||||||
UINT options,
|
UINT options,
|
||||||
bool working = true);
|
bool working = true);
|
||||||
|
|
||||||
|
@ -217,7 +228,9 @@ class instr_item { // An Abstract Base Class (ABC)
|
||||||
RECT get_location ( void ) { return scrn_pos; }
|
RECT get_location ( void ) { return scrn_pos; }
|
||||||
bool is_broken ( void ) { return broken; }
|
bool is_broken ( void ) { return broken; }
|
||||||
bool enabled ( void ) { return is_enabled;}
|
bool enabled ( void ) { return is_enabled;}
|
||||||
double get_value ( void ) { return load_value_fn();}
|
bool data_available ( void ) { return !!load_value_fn; }
|
||||||
|
double get_value ( void ) { return load_value_fn(); }
|
||||||
|
double 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; }
|
||||||
|
@ -259,6 +272,7 @@ class instr_label : public instr_item {
|
||||||
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,
|
||||||
UINT options = HUDS_TOP,
|
UINT options = HUDS_TOP,
|
||||||
fgLabelJust justification = CENTER_JUST,
|
fgLabelJust justification = CENTER_JUST,
|
||||||
int font_size = SMALL,
|
int font_size = SMALL,
|
||||||
|
@ -269,7 +283,6 @@ class instr_label : public instr_item {
|
||||||
|
|
||||||
instr_label( const instr_label & image);
|
instr_label( const instr_label & image);
|
||||||
instr_label & operator = (const instr_label & rhs );
|
instr_label & operator = (const instr_label & rhs );
|
||||||
|
|
||||||
virtual void draw( void ); // Required method in base class
|
virtual void draw( void ); // Required method in base class
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -289,7 +302,6 @@ class instr_scale : public instr_item {
|
||||||
double scale_factor; // factor => screen units/range values.
|
double 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
|
||||||
double disp_factor; // Multiply by to get numbers shown on scale.
|
|
||||||
UINT Modulo; // Roll over point
|
UINT Modulo; // Roll over point
|
||||||
int signif_digits; // digits to show to the right.
|
int signif_digits; // digits to show to the right.
|
||||||
|
|
||||||
|
@ -480,6 +492,7 @@ class HudLadder : public dual_instr_item {
|
||||||
//using namespace std;
|
//using namespace std;
|
||||||
//deque <instr_item> * Hdeque_ptr;
|
//deque <instr_item> * Hdeque_ptr;
|
||||||
|
|
||||||
|
extern void HUD_brightkey( bool incr_bright );
|
||||||
extern int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ );
|
extern int fgHUDInit( fgAIRCRAFT * /* current_aircraft */ );
|
||||||
extern void fgUpdateHUD( void );
|
extern void fgUpdateHUD( void );
|
||||||
|
|
||||||
|
@ -509,9 +522,13 @@ void fgHUDSetTimeMode( Hptr hud, int time_of_day );
|
||||||
#endif // _HUD_H
|
#endif // _HUD_H
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.8 1998/07/03 13:16:29 curt
|
/* Revision 1.9 1998/07/13 21:00:48 curt
|
||||||
/* Added Charlie Hotchkiss's HUD updates and improvementes.
|
/* Integrated Charlies latest HUD updates.
|
||||||
|
/* Wrote access functions for current fgOPTIONS.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.8 1998/07/03 13:16:29 curt
|
||||||
|
* Added Charlie Hotchkiss's HUD updates and improvementes.
|
||||||
|
*
|
||||||
* Revision 1.6 1998/06/03 00:43:28 curt
|
* Revision 1.6 1998/06/03 00:43:28 curt
|
||||||
* No .h when including stl stuff.
|
* No .h when including stl stuff.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
int marker_xe;
|
int marker_xe;
|
||||||
int marker_ys;
|
int marker_ys;
|
||||||
int marker_ye;
|
int marker_ye;
|
||||||
register i;
|
/* register */ int i;
|
||||||
char TextScale[80];
|
char TextScale[80];
|
||||||
bool condition;
|
bool condition;
|
||||||
int disp_val;
|
int disp_val;
|
||||||
|
@ -170,8 +170,8 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
}
|
}
|
||||||
if( div_min()) {
|
if( div_min()) {
|
||||||
if( (i%div_min()) == 0) {
|
if( (i%div_min()) == 0) {
|
||||||
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) < (scrn_rect.top + scrn_rect.bottom))){
|
||||||
if( (options & HUDS_BOTH) == HUDS_BOTH ) {
|
if( (options & HUDS_BOTH) == HUDS_BOTH ) {
|
||||||
drawOneLine( scrn_rect.left, marker_ys,
|
drawOneLine( scrn_rect.left, marker_ys,
|
||||||
marker_xs, marker_ys );
|
marker_xs, marker_ys );
|
||||||
|
@ -204,9 +204,9 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
else {
|
else {
|
||||||
disp_val = i;
|
disp_val = i;
|
||||||
}
|
}
|
||||||
sprintf( TextScale, "%d", disp_val );
|
sprintf( TextScale, "%d", (int)(disp_val * data_scaling() +.5));
|
||||||
if(( (marker_ys - 5 ) > scrn_rect.top ) ||
|
if(( (marker_ys - 8 ) > scrn_rect.top ) &&
|
||||||
( (marker_ys + 5) < (scrn_rect.top + scrn_rect.bottom))){
|
( (marker_ys + 8) < (scrn_rect.top + scrn_rect.bottom))){
|
||||||
if( (options & HUDS_BOTH) == HUDS_BOTH) {
|
if( (options & HUDS_BOTH) == HUDS_BOTH) {
|
||||||
drawOneLine( scrn_rect.left, marker_ys,
|
drawOneLine( scrn_rect.left, marker_ys,
|
||||||
marker_xs, marker_ys);
|
marker_xs, marker_ys);
|
||||||
|
@ -232,7 +232,7 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
TextScale, GLUT_BITMAP_8_BY_13 );
|
TextScale, GLUT_BITMAP_8_BY_13 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // Else read oriented right
|
} // Else read oriented right
|
||||||
} // End if modulo division by major interval is zero
|
} // End if modulo division by major interval is zero
|
||||||
} // End if major interval divisor non-zero
|
} // End if major interval divisor non-zero
|
||||||
|
@ -291,20 +291,23 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
// marker_ye = marker_xe;
|
// marker_ye = marker_xe;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// printf("vmin = %d vmax = %d\n", (int)vmin, (int)vmax);
|
||||||
for( i = (int)vmin; i <= (int)vmax; i++ ) {
|
for( i = (int)vmin; i <= (int)vmax; i++ ) {
|
||||||
|
// printf("<*> i = %d\n", i);
|
||||||
condition = true;
|
condition = true;
|
||||||
if( !modulo()) {
|
if( !modulo()) {
|
||||||
if( i < min_val()) {
|
if( i < min_val()) {
|
||||||
condition = false;
|
condition = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 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);
|
||||||
if( div_min()){
|
if( div_min()){
|
||||||
if( (i%(int)div_min()) == 0 ) {
|
if( (i%(int)div_min()) == 0 ) {
|
||||||
// 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( (options & HUDS_BOTH) == HUDS_BOTH ) {
|
||||||
drawOneLine( marker_xs, scrn_rect.top,
|
drawOneLine( marker_xs, scrn_rect.top,
|
||||||
|
@ -325,7 +328,9 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// printf("<***> i = %d\n", i);
|
||||||
if( div_max()) {
|
if( div_max()) {
|
||||||
|
// printf("i = %d\n", i);
|
||||||
if( (i%(int)div_max())==0 ) {
|
if( (i%(int)div_max())==0 ) {
|
||||||
if(modulo()) {
|
if(modulo()) {
|
||||||
if( disp_val < 0) {
|
if( disp_val < 0) {
|
||||||
|
@ -338,7 +343,9 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
else {
|
else {
|
||||||
disp_val = i;
|
disp_val = i;
|
||||||
}
|
}
|
||||||
sprintf( TextScale, "%d", disp_val );
|
// printf("disp_val = %d\n", disp_val);
|
||||||
|
// printf("%d\n", (int)(disp_val * (double)data_scaling() + 0.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) < (scrn_rect.left + scrn_rect.right))){
|
||||||
|
@ -372,7 +379,8 @@ draw( void ) // (HUD_scale * pscale )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// printf("<****> i = %d\n", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ void guage_instr :: draw (void)
|
||||||
|
|
||||||
if( !(options & HUDS_NOTEXT)) {
|
if( !(options & HUDS_NOTEXT)) {
|
||||||
disp_val = i;
|
disp_val = i;
|
||||||
sprintf( TextScale, "%d", disp_val );
|
sprintf( TextScale, "%d",disp_val * (int)(data_scaling() +.5));
|
||||||
|
|
||||||
if((options & HUDS_LEFT) && (options && HUDS_RIGHT)) {
|
if((options & HUDS_LEFT) && (options && HUDS_RIGHT)) {
|
||||||
text_x = mid_scr.x - 2 - ((3 * strlen( TextScale ))>>1);
|
text_x = mid_scr.x - 2 - ((3 * strlen( TextScale ))>>1);
|
||||||
|
@ -209,16 +209,16 @@ void guage_instr :: draw (void)
|
||||||
// text_x = marker_xs - scrn_rect.left;
|
// text_x = marker_xs - scrn_rect.left;
|
||||||
|
|
||||||
if( options & HUDS_RIGHT ) {
|
if( options & HUDS_RIGHT ) {
|
||||||
drawOneLine(scrn_rect.left, text_y,
|
drawOneLine(scrn_rect.left, text_y + 5,
|
||||||
marker_xe, text_y + 5);
|
marker_xe, text_y);
|
||||||
drawOneLine(scrn_rect.left, text_y,
|
drawOneLine(scrn_rect.left, text_y - 5,
|
||||||
marker_xe, text_y - 5);
|
marker_xe, text_y);
|
||||||
}
|
}
|
||||||
if( options & HUDS_LEFT ) {
|
if( options & HUDS_LEFT ) {
|
||||||
drawOneLine(scrn_rect.left + scrn_rect.right, text_y,
|
drawOneLine(scrn_rect.left + scrn_rect.right, text_y + 5,
|
||||||
marker_xs, text_y + 5);
|
marker_xs, text_y);
|
||||||
drawOneLine(scrn_rect.left + scrn_rect.right, text_y,
|
drawOneLine(scrn_rect.left + scrn_rect.right, text_y - 5,
|
||||||
marker_xs, text_y - 5);
|
marker_xs, text_y);
|
||||||
}
|
}
|
||||||
} // End if VERTICAL SCALE TYPE
|
} // End if VERTICAL SCALE TYPE
|
||||||
else { // Horizontal scale by default
|
else { // Horizontal scale by default
|
||||||
|
@ -315,7 +315,7 @@ void guage_instr :: draw (void)
|
||||||
else {
|
else {
|
||||||
disp_val = i;
|
disp_val = i;
|
||||||
}
|
}
|
||||||
sprintf( TextScale, "%d", disp_val );
|
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) < (scrn_rect.left + scrn_rect.right))){
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#ifdef HAVE_WINDOWS_H
|
#ifdef HAVE_WINDOWS_H
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <Aircraft/aircraft.h>
|
#include <Aircraft/aircraft.h>
|
||||||
|
@ -22,7 +23,9 @@
|
||||||
|
|
||||||
#include "hud.hxx"
|
#include "hud.hxx"
|
||||||
|
|
||||||
UINT instr_item :: instances; // Initial value of zero
|
UINT instr_item :: instances = 0; // Initial value of zero
|
||||||
|
int instr_item :: brightness = BRT_MEDIUM;
|
||||||
|
glRGBTRIPLE instr_item :: color = {0.1, 0.7, 0.0};
|
||||||
|
|
||||||
// constructor ( No default provided )
|
// constructor ( No default provided )
|
||||||
instr_item ::
|
instr_item ::
|
||||||
|
@ -31,14 +34,15 @@ instr_item ::
|
||||||
UINT width,
|
UINT width,
|
||||||
UINT height,
|
UINT height,
|
||||||
DBLFNPTR data_source,
|
DBLFNPTR data_source,
|
||||||
|
double data_scaling,
|
||||||
UINT options,
|
UINT options,
|
||||||
bool working) :
|
bool working) :
|
||||||
handle ( ++instances ),
|
handle ( ++instances ),
|
||||||
load_value_fn ( data_source ),
|
load_value_fn ( data_source ),
|
||||||
|
disp_factor ( data_scaling ),
|
||||||
opts ( options ),
|
opts ( options ),
|
||||||
is_enabled ( working ),
|
is_enabled ( working ),
|
||||||
broken ( FALSE ),
|
broken ( FALSE )
|
||||||
brightness ( BRT_MEDIUM )
|
|
||||||
{
|
{
|
||||||
scrn_pos.left = x;
|
scrn_pos.left = x;
|
||||||
scrn_pos.top = y;
|
scrn_pos.top = y;
|
||||||
|
@ -76,10 +80,10 @@ instr_item ::
|
||||||
handle ( ++instances ),
|
handle ( ++instances ),
|
||||||
scrn_pos ( image.scrn_pos ),
|
scrn_pos ( image.scrn_pos ),
|
||||||
load_value_fn( image.load_value_fn),
|
load_value_fn( image.load_value_fn),
|
||||||
|
disp_factor ( image.disp_factor ),
|
||||||
opts ( image.opts ),
|
opts ( image.opts ),
|
||||||
is_enabled ( image.is_enabled ),
|
is_enabled ( image.is_enabled ),
|
||||||
broken ( image.broken ),
|
broken ( image.broken ),
|
||||||
brightness ( image.brightness ),
|
|
||||||
scr_span ( image.scr_span ),
|
scr_span ( image.scr_span ),
|
||||||
mid_span ( image.mid_span )
|
mid_span ( image.mid_span )
|
||||||
{
|
{
|
||||||
|
@ -92,10 +96,10 @@ instr_item & instr_item :: operator = ( const instr_item & rhs )
|
||||||
if( !(this == &rhs )) { // Not an identity assignment
|
if( !(this == &rhs )) { // Not an identity assignment
|
||||||
scrn_pos = rhs.scrn_pos;
|
scrn_pos = rhs.scrn_pos;
|
||||||
load_value_fn = rhs.load_value_fn;
|
load_value_fn = rhs.load_value_fn;
|
||||||
|
disp_factor = rhs.disp_factor;
|
||||||
opts = rhs.opts;
|
opts = rhs.opts;
|
||||||
is_enabled = rhs.is_enabled;
|
is_enabled = rhs.is_enabled;
|
||||||
broken = rhs.broken;
|
broken = rhs.broken;
|
||||||
brightness = rhs.brightness;
|
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,13 +30,14 @@ instr_label ::
|
||||||
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,
|
||||||
UINT options,
|
UINT options,
|
||||||
fgLabelJust justification,
|
fgLabelJust justification,
|
||||||
int font_size,
|
int font_size,
|
||||||
int blinking,
|
int blinking,
|
||||||
bool working ):
|
bool working ):
|
||||||
instr_item( x, y, width, height,
|
instr_item( x, y, width, height,
|
||||||
data_source, options, working ),
|
data_source, scale_data,options, working ),
|
||||||
pformat ( label_format ),
|
pformat ( label_format ),
|
||||||
pre_str ( pre_label_string ),
|
pre_str ( pre_label_string ),
|
||||||
post_str ( post_label_string ),
|
post_str ( post_label_string ),
|
||||||
|
@ -78,7 +79,6 @@ instr_label & instr_label ::operator = (const instr_label & rhs )
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// draw Draws a label anywhere in the HUD
|
// draw Draws a label anywhere in the HUD
|
||||||
//
|
//
|
||||||
|
@ -106,7 +106,13 @@ 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.
|
||||||
|
|
||||||
sprintf( label_buffer, format_buffer, get_value() );
|
if( data_available() ) {
|
||||||
|
sprintf( label_buffer, format_buffer, get_value() );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
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" );
|
||||||
|
|
|
@ -47,11 +47,11 @@ instr_scale ( int x,
|
||||||
UINT rollover,
|
UINT rollover,
|
||||||
int dp_showing,
|
int dp_showing,
|
||||||
bool working ) :
|
bool working ) :
|
||||||
instr_item( x, y, width, height, load_fn, options, working),
|
instr_item( x, y, width, height,
|
||||||
|
load_fn, disp_scale, options, working),
|
||||||
range_shown ( show_range ),
|
range_shown ( show_range ),
|
||||||
Maximum_value( maxValue ),
|
Maximum_value( maxValue ),
|
||||||
Minimum_value( minValue ),
|
Minimum_value( minValue ),
|
||||||
scale_factor ( disp_scale ),
|
|
||||||
Maj_div ( major_divs ),
|
Maj_div ( major_divs ),
|
||||||
Min_div ( minor_divs ),
|
Min_div ( minor_divs ),
|
||||||
Modulo ( rollover ),
|
Modulo ( rollover ),
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
#include "panel.hxx"
|
#include "panel.hxx"
|
||||||
|
|
||||||
|
// Intriquing. Needs documentation.
|
||||||
|
|
||||||
#define IMAGIC 0x01da
|
#define IMAGIC 0x01da
|
||||||
#define IMAGIC_SWAP 0xda01
|
#define IMAGIC_SWAP 0xda01
|
||||||
|
@ -77,13 +78,7 @@ static GLuint panel_tex_id;
|
||||||
static GLubyte tex[512][256][4];
|
static GLubyte tex[512][256][4];
|
||||||
|
|
||||||
|
|
||||||
static double get_speed( void )
|
extern double get_speed( void );
|
||||||
{
|
|
||||||
fgFLIGHT *f;
|
|
||||||
|
|
||||||
f = current_aircraft.flight;
|
|
||||||
return( FG_V_equiv_kts ); // Make an explicit function call.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* image.c ,temporary hack, I know*/
|
/* image.c ,temporary hack, I know*/
|
||||||
|
@ -291,12 +286,9 @@ static IMAGE *ImageLoad(char *fileName)
|
||||||
|
|
||||||
|
|
||||||
void fgPanelInit ( void ) {
|
void fgPanelInit ( void ) {
|
||||||
fgOPTIONS *o;
|
|
||||||
char tpath[256];
|
char tpath[256];
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
o = ¤t_options;
|
|
||||||
|
|
||||||
#ifdef GL_VERSION_1_1
|
#ifdef GL_VERSION_1_1
|
||||||
xglGenTextures(1, &panel_tex_id);
|
xglGenTextures(1, &panel_tex_id);
|
||||||
xglBindTexture(GL_TEXTURE_2D, panel_tex_id);
|
xglBindTexture(GL_TEXTURE_2D, panel_tex_id);
|
||||||
|
@ -315,8 +307,7 @@ void fgPanelInit ( void ) {
|
||||||
xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
xglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
|
||||||
/* load in the texture data */
|
/* load in the texture data */
|
||||||
tpath[0] = '\0';
|
current_options.get_fg_root(tpath);
|
||||||
strcat(tpath, o->fg_root);
|
|
||||||
strcat(tpath, "/Textures/");
|
strcat(tpath, "/Textures/");
|
||||||
strcat(tpath, "panel1.rgb");
|
strcat(tpath, "panel1.rgb");
|
||||||
|
|
||||||
|
@ -425,9 +416,13 @@ void fgPanelUpdate ( void ) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.2 1998/07/03 11:55:37 curt
|
/* Revision 1.3 1998/07/13 21:00:52 curt
|
||||||
/* A few small rearrangements and tweaks.
|
/* Integrated Charlies latest HUD updates.
|
||||||
|
/* Wrote access functions for current fgOPTIONS.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.2 1998/07/03 11:55:37 curt
|
||||||
|
* A few small rearrangements and tweaks.
|
||||||
|
*
|
||||||
* Revision 1.1 1998/06/27 16:47:54 curt
|
* Revision 1.1 1998/06/27 16:47:54 curt
|
||||||
* Incorporated Friedemann Reinhard's <mpt218@faupt212.physik.uni-erlangen.de>
|
* Incorporated Friedemann Reinhard's <mpt218@faupt212.physik.uni-erlangen.de>
|
||||||
* first pass at an isntrument panel.
|
* first pass at an isntrument panel.
|
||||||
|
|
Loading…
Add table
Reference in a new issue