]> git.mxchange.org Git - flightgear.git/blob - src/Cockpit/hud_inst.cxx
remove assignment operators: they aren't used now and won't in the future
[flightgear.git] / src / Cockpit / hud_inst.cxx
1
2 #include "hud.hxx"
3
4
5 UINT instr_item :: instances = 0;  // Initial value of zero
6 int  instr_item :: brightness = 5;/*HUD_BRT_MEDIUM*/
7 //glRGBTRIPLE instr_item :: color = {0.1, 0.7, 0.0};
8 glRGBTRIPLE instr_item :: color = {0.0, 1.0, 0.0};
9
10 // constructor    ( No default provided )
11 instr_item  ::
12    instr_item( int              x,
13                int              y,
14                UINT             width,
15                UINT             height,
16                FLTFNPTR         data_source,
17                float           data_scaling,
18                UINT             options,
19                bool             working,
20                            int                          digit) : //suma
21                       handle         ( ++instances  ),
22                       load_value_fn  ( data_source  ),
23                       disp_factor    ( data_scaling ),
24                       opts           ( options      ),
25                       is_enabled     ( working      ),
26                       broken         ( FALSE        ),
27                       digits             ( digit                ) //suma
28 {
29   scrn_pos.left   = x;
30   scrn_pos.top    = y;
31   scrn_pos.right  = width;
32   scrn_pos.bottom = height;
33
34          // Set up convenience values for centroid of the box and
35          // the span values according to orientation
36
37   if( opts & HUDS_VERT) { // Vertical style
38          // Insure that the midpoint marker will fall exactly at the
39          // middle of the bar.
40     if( !(scrn_pos.bottom % 2)) {
41       scrn_pos.bottom++;
42       }
43     scr_span = scrn_pos.bottom;
44     }
45   else {
46          // Insure that the midpoint marker will fall exactly at the
47          // middle of the bar.
48     if( !(scrn_pos.right % 2)) {
49       scrn_pos.right++;
50       }
51     scr_span = scrn_pos.right;
52     }
53          // Here we work out the centroid for the corrected box.
54   mid_span.x = scrn_pos.left   + (scrn_pos.right  >> 1);
55   mid_span.y = scrn_pos.top + (scrn_pos.bottom >> 1);
56 }
57
58
59 // copy constructor
60 instr_item  ::
61      instr_item ( const instr_item & image ):
62                          handle       ( ++instances        ),
63                          scrn_pos     ( image.scrn_pos     ),
64                          load_value_fn( image.load_value_fn),
65                          disp_factor  ( image.disp_factor  ),
66                          opts         ( image.opts         ),
67                          is_enabled   ( image.is_enabled   ),
68                          broken       ( image.broken       ),
69                          scr_span     ( image.scr_span     ),
70                          mid_span     ( image.mid_span     )
71 {
72 }
73
74
75 instr_item :: ~instr_item ()
76 {
77   if( instances ) {
78     instances--;
79     }
80 }
81
82 void instr_item ::
83     update( void )
84 {
85 }
86
87 // break_display       This is emplaced to provide hooks for making
88 //                     instruments unreliable. The default behavior is
89 // to simply not display, but more sophisticated behavior is available
90 // by over riding the function which is virtual in this class.
91
92 void instr_item ::
93     break_display ( bool bad )
94 {
95   broken = !!bad;
96   is_enabled = FALSE;
97 }
98
99 void instr_item ::
100     SetBrightness  ( int level  )
101 {
102   brightness = level;   // This is all we will do for now. Later the
103                         // brightness levels will be sensitive both to
104                         // the control knob and the outside light levels
105                         // to emulated night vision effects.
106 }
107
108 UINT instr_item :: get_Handle( void )
109 {
110   return handle;
111 }
112