1 // Abstract Base Class instr_item
\r
12 #include <Aircraft/aircraft.h>
13 #include <Debug/fg_debug.h>
14 #include <Include/fg_constants.h>
15 #include <Math/fg_random.h>
16 #include <Math/mat3.h>
17 #include <Math/polar3d.hxx>
18 #include <Scenery/scenery.hxx>
19 #include <Time/fg_timer.hxx>
20 #include <Weather/weather.h>
25 UINT instr_item :: instances; // Initial value of zero
27 // constructor ( No default provided )
36 handle ( ++instances ),
37 load_value_fn ( data_source ),
39 is_enabled ( working ),
41 brightness ( BRT_MEDIUM )
45 scrn_pos.right = width;
46 scrn_pos.bottom = height;
48 // Set up convenience values for centroid of the box and
49 // the span values according to orientation
51 if( opts & HUDS_VERT) { // Vertical style
52 // Insure that the midpoint marker will fall exactly at the
54 if( !(scrn_pos.bottom % 2)) {
57 scr_span = scrn_pos.bottom;
60 // Insure that the midpoint marker will fall exactly at the
62 if( !(scrn_pos.right % 2)) {
65 scr_span = scrn_pos.right;
67 // Here we work out the centroid for the corrected box.
68 mid_span.x = scrn_pos.left + (scrn_pos.right >> 1);
69 mid_span.y = scrn_pos.top + (scrn_pos.bottom >> 1);
75 instr_item ( const instr_item & image ):
76 handle ( ++instances ),
77 scrn_pos ( image.scrn_pos ),
78 load_value_fn( image.load_value_fn),
80 is_enabled ( image.is_enabled ),
81 broken ( image.broken ),
82 brightness ( image.brightness ),
83 scr_span ( image.scr_span ),
84 mid_span ( image.mid_span )
88 // assignment operator
90 instr_item & instr_item :: operator = ( const instr_item & rhs )
92 if( !(this == &rhs )) { // Not an identity assignment
93 scrn_pos = rhs.scrn_pos;
94 load_value_fn = rhs.load_value_fn;
96 is_enabled = rhs.is_enabled;
98 brightness = rhs.brightness;
105 instr_item :: ~instr_item ()
117 // break_display This is emplaced to provide hooks for making
118 // instruments unreliable. The default behavior is
119 // to simply not display, but more sophisticated behavior is available
120 // by over riding the function which is virtual in this class.
123 break_display ( bool bad )
130 SetBrightness ( int level )
132 brightness = level; // This is all we will do for now. Later the
133 // brightness levels will be sensitive both to
134 // the control knob and the outside light levels
135 // to emulated night vision effects.
138 UINT instr_item :: get_Handle( void )