remove readCard() and let the hud_card class read its properties
This commit is contained in:
parent
9e2de090b4
commit
4e8a89c9c0
3 changed files with 424 additions and 659 deletions
|
@ -83,48 +83,16 @@ int HUD_style = 0;
|
|||
float HUD_matrix[16];
|
||||
|
||||
static string name;
|
||||
static int x;
|
||||
static int y;
|
||||
static UINT width;
|
||||
static UINT height;
|
||||
static float span_units;
|
||||
static bool working;
|
||||
static string loadfn;
|
||||
static UINT options;
|
||||
static float maxValue;
|
||||
static float minValue;
|
||||
static float scaling;
|
||||
static UINT major_divs;
|
||||
static UINT minor_divs;
|
||||
static UINT modulator;
|
||||
static int dp_showing = 0;
|
||||
static string label_format;
|
||||
static string prelabel;
|
||||
static string postlabel;
|
||||
static bool tick_bottom;
|
||||
static bool tick_top;
|
||||
static bool tick_right;
|
||||
static bool tick_left;
|
||||
static bool cap_bottom;
|
||||
static bool cap_top;
|
||||
static bool cap_right;
|
||||
static bool cap_left;
|
||||
static float marker_off;
|
||||
static string type;
|
||||
static bool enable_pointer;
|
||||
static string type_pointer;
|
||||
static string type_tick;
|
||||
static string length_tick;
|
||||
static float radius;
|
||||
static int divisions;
|
||||
static int zoom;
|
||||
|
||||
|
||||
static FLTFNPTR load_fn;
|
||||
|
||||
int readHud( istream &input );
|
||||
int readInstrument ( const SGPropertyNode * node);
|
||||
static instr_item * readCardDialTape ( const SGPropertyNode * node);
|
||||
|
||||
static void drawHUD();
|
||||
static void fgUpdateHUDVirtual();
|
||||
|
@ -157,110 +125,6 @@ locRECT :: locRECT( UINT left, UINT top, UINT right, UINT bottom)
|
|||
// mustange and the engine readouts of a B36!
|
||||
//
|
||||
|
||||
static instr_item *
|
||||
readCardDialTape(const SGPropertyNode * node)
|
||||
{
|
||||
instr_item *p;
|
||||
|
||||
x = node->getIntValue("x");
|
||||
y = node->getIntValue("y");
|
||||
width = node->getIntValue("width");
|
||||
height = node->getIntValue("height");
|
||||
loadfn = node->getStringValue("loadfn");
|
||||
options = node->getIntValue("options");
|
||||
maxValue = node->getFloatValue("maxValue");
|
||||
minValue = node->getFloatValue("minValue");
|
||||
scaling = node->getFloatValue("disp_scaling");
|
||||
major_divs = node->getIntValue("major_divs");
|
||||
minor_divs = node->getIntValue("minor_divs");
|
||||
modulator = node->getIntValue("modulator");
|
||||
span_units = node->getFloatValue("value_span");
|
||||
type = node->getStringValue("type");
|
||||
tick_bottom = node->getBoolValue("tick_bottom",false);
|
||||
tick_top = node->getBoolValue("tick_top",false);
|
||||
tick_right = node->getBoolValue("tick_right",false);
|
||||
tick_left = node->getBoolValue("tick_left",false);
|
||||
cap_bottom = node->getBoolValue("cap_bottom",false);
|
||||
cap_top = node->getBoolValue("cap_top",false);
|
||||
cap_right = node->getBoolValue("cap_right",false);
|
||||
cap_left = node->getBoolValue("cap_left",false);
|
||||
marker_off = node->getFloatValue("marker_offset",0.0);
|
||||
enable_pointer = node->getBoolValue("enable_pointer",true);
|
||||
type_pointer = node->getStringValue("pointer_type");
|
||||
type_tick = node->getStringValue("tick_type"); // 'circle' or 'line'
|
||||
length_tick = node->getStringValue("tick_length"); // for variable length
|
||||
working = node->getBoolValue("working");
|
||||
radius = node->getFloatValue("radius");
|
||||
divisions = node->getIntValue("divisions");
|
||||
zoom = node->getIntValue("zoom");
|
||||
|
||||
SG_LOG(SG_INPUT, SG_INFO, "Done reading dial/tape instrument "
|
||||
<< node->getStringValue("name", "[none]"));
|
||||
|
||||
if (loadfn=="anzg") {
|
||||
load_fn = get_anzg;
|
||||
} else if (loadfn=="heading") {
|
||||
load_fn = get_heading;
|
||||
} else if (loadfn=="aoa") {
|
||||
load_fn = get_aoa;
|
||||
} else if (loadfn=="climb") {
|
||||
load_fn = get_climb_rate;
|
||||
} else if (loadfn=="altitude") {
|
||||
load_fn = get_altitude;
|
||||
} else if (loadfn=="agl") {
|
||||
load_fn = get_agl;
|
||||
} else if (loadfn=="speed") {
|
||||
load_fn = get_speed;
|
||||
} else if (loadfn=="view_direction") {
|
||||
load_fn = get_view_direction;
|
||||
} else if (loadfn=="aileronval") {
|
||||
load_fn = get_aileronval;
|
||||
} else if (loadfn=="elevatorval") {
|
||||
load_fn = get_elevatorval;
|
||||
} else if (loadfn=="elevatortrimval") {
|
||||
load_fn = get_elev_trimval;
|
||||
} else if (loadfn=="rudderval") {
|
||||
load_fn = get_rudderval;
|
||||
} else if (loadfn=="throttleval") {
|
||||
load_fn = get_throttleval;
|
||||
}
|
||||
|
||||
|
||||
// type == "dial") || (type == "tape")
|
||||
p = (instr_item *) new hud_card( x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
load_fn,
|
||||
options,
|
||||
maxValue, minValue,
|
||||
scaling,
|
||||
major_divs, minor_divs,
|
||||
modulator,
|
||||
dp_showing,
|
||||
span_units,
|
||||
type,
|
||||
tick_bottom,
|
||||
tick_top,
|
||||
tick_right,
|
||||
tick_left,
|
||||
cap_bottom,
|
||||
cap_top,
|
||||
cap_right,
|
||||
cap_left,
|
||||
marker_off,
|
||||
enable_pointer,
|
||||
type_pointer,
|
||||
type_tick,
|
||||
length_tick,
|
||||
working,
|
||||
radius,
|
||||
divisions,
|
||||
zoom
|
||||
);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int readInstrument(const SGPropertyNode * node)
|
||||
|
@ -294,7 +158,7 @@ int readInstrument(const SGPropertyNode * node)
|
|||
if (!strcmp(type, "gauge"))
|
||||
HIptr = static_cast<instr_item *>(new gauge_instr(card_group->getChild(j)));
|
||||
else if (!strcmp(type, "dial") || !strcmp(type, "tape"))
|
||||
HIptr = readCardDialTape(card_group->getChild(j));
|
||||
HIptr = static_cast<instr_item *>(new hud_card(card_group->getChild(j)));
|
||||
HUD_deque.insert(HUD_deque.begin(), HIptr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -711,17 +711,17 @@ public:
|
|||
virtual ~instr_scale();
|
||||
instr_scale( const instr_scale & image);
|
||||
|
||||
virtual void draw ( void ) {}; // No-op here. Defined in derived classes.
|
||||
UINT div_min ( void ) { return Min_div;}
|
||||
UINT div_max ( void ) { return Maj_div;}
|
||||
float min_val ( void ) { return Minimum_value;}
|
||||
float max_val ( void ) { return Maximum_value;}
|
||||
UINT modulo ( void ) { return Modulo; }
|
||||
float factor ( void ) { return scale_factor;}
|
||||
float range_to_show ( void ) { return range_shown;}
|
||||
virtual void draw ( void ) {}; // No-op here. Defined in derived classes.
|
||||
UINT div_min ( void ) { return Min_div;}
|
||||
UINT div_max ( void ) { return Maj_div;}
|
||||
float min_val ( void ) { return Minimum_value;}
|
||||
float max_val ( void ) { return Maximum_value;}
|
||||
UINT modulo ( void ) { return Modulo; }
|
||||
float factor ( void ) { return scale_factor;}
|
||||
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
|
||||
// a scale that moves past the pointer. It may be
|
||||
// horizontal or vertical, read above(left) or below(right) of the base
|
||||
// line.
|
||||
|
@ -752,50 +752,13 @@ private:
|
|||
UINT Maj_div;
|
||||
UINT Min_div;
|
||||
|
||||
|
||||
public:
|
||||
hud_card( int x,
|
||||
int y,
|
||||
UINT width,
|
||||
UINT height,
|
||||
FLTFNPTR load_fn,
|
||||
UINT options,
|
||||
float maxValue,
|
||||
float minValue,
|
||||
float disp_scaling,
|
||||
UINT major_divs,
|
||||
UINT minor_divs,
|
||||
UINT modulator,
|
||||
int dp_showing,
|
||||
float value_span,
|
||||
string type,
|
||||
bool draw_tick_bottom,
|
||||
bool draw_tick_top,
|
||||
bool draw_tick_right,
|
||||
bool draw_tick_left,
|
||||
bool draw_cap_bottom,
|
||||
bool draw_cap_top,
|
||||
bool draw_cap_right,
|
||||
bool draw_cap_left,
|
||||
float marker_offset,
|
||||
bool pointer,
|
||||
string pointer_type,
|
||||
string tick_type,
|
||||
string tick_length,
|
||||
bool working,
|
||||
float radius,
|
||||
int divisions,
|
||||
int zoom
|
||||
);
|
||||
|
||||
|
||||
~hud_card();
|
||||
hud_card( const hud_card & image);
|
||||
// virtual void display_enable( bool setting );
|
||||
virtual void draw( void ); // Required method in base class
|
||||
void circles(float,float,float);
|
||||
void fixed(float,float,float,float,float,float);
|
||||
void zoomed_scale(int,int);
|
||||
hud_card(const SGPropertyNode *);
|
||||
// virtual void display_enable( bool setting ); // FIXME
|
||||
virtual void draw(void);
|
||||
void circles(float, float, float);
|
||||
void fixed(float, float, float, float, float, float);
|
||||
void zoomed_scale(int, int);
|
||||
};
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue