]> git.mxchange.org Git - flightgear.git/blob - Cockpit/hud.h
5587cfbd679d0334e9f56c607ac7e0bcdb33aaa3
[flightgear.git] / Cockpit / hud.h
1 /**************************************************************************
2  * hud.h -- hud defines and prototypes (initial draft)
3  *
4  * Written by Michele America, started September 1997.
5  *
6  * Copyright (C) 1997  Michele F. America  - nomimarketing@mail.telepac.pt
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of the
11  * License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  * $Id$
23  * (Log is kept at end of this file)
24  **************************************************************************/
25
26
27 #ifndef _HUD_H
28 #define _HUD_H
29
30 #include <Aircraft/aircraft.h>
31 #include <Flight/flight.h>
32 #include <Controls/controls.h>
33
34 // View mode definitions
35
36 enum VIEW_MODES { HUD_VIEW, PANEL_VIEW, CHASE_VIEW, TOWER_VIEW };
37
38 // Hud general constants
39 #define DAY                1
40 #define NIGHT              2
41 #define BRT_DARK           3
42 #define BRT_MEDIUM         4
43 #define BRT_LIGHT          5
44 #define SIZE_SMALL         6
45 #define SIZE_LARGE         7
46
47 // Instrument types
48 #define ARTIFICIAL_HORIZON      1
49 #define SCALE              2
50 #define LADDER             3
51 #define LABEL              4
52
53 // Scale constants
54 #define HORIZONTAL         1
55 #define TOP                2
56 #define BOTTOM             3
57 #define VERTICAL           4
58 #define LEFT               5
59 #define RIGHT              6
60 #define LIMIT              7
61 #define NOLIMIT            8
62 #define ROUNDROB           9
63
64 // Label constants
65 #define SMALL              1
66 #define LARGE              2
67 #define BLINK              3
68 #define NOBLINK            4
69 #define LEFT_JUST          5
70 #define CENTER_JUST        6
71 #define RIGHT_JUST         7
72
73 // Ladder constants
74 #define NONE               1
75 #define UPPER_LEFT         2
76 #define UPPER_CENTER       3
77 #define UPPER_RIGHT        4
78 #define CENTER_RIGHT       5
79 #define LOWER_RIGHT        6
80 #define LOWER_CENTER       7
81 #define LOWER_LEFT         8
82 #define CENTER_LEFT        9
83 #define SOLID_LINES       10
84 #define DASHED_LINES      11
85 #define DASHED_NEG_LINES  12
86
87 // Ladder orientaion
88 // #define HUD_VERTICAL        1
89 // #define HUD_HORIZONTAL               2
90 // #define HUD_FREEFLOAT                3
91
92 // Ladder orientation modes
93 // #define HUD_LEFT             1
94 // #define HUD_RIGHT            2
95 // #define HUD_TOP              1
96 // #define HUD_BOTTOM           2
97 // #define HUD_V_LEFT                   1
98 // #define HUD_V_RIGHT          2
99 // #define HUD_H_TOP            1
100 // #define HUD_H_BOTTOM         2
101
102
103 // Ladder sub-types
104 // #define HUD_LIM                              1
105 // #define HUD_NOLIM                    2
106 // #define HUD_CIRC                     3
107
108 // #define HUD_INSTR_LADDER     1
109 // #define HUD_INSTR_CLADDER    2
110 // #define HUD_INSTR_HORIZON    3
111 // #define HUD_INSTR_LABEL              4
112
113 // The following structs will become classes with a derivation from
114 // an ABC instrument_pack. Eventually the instruments may well become
115 // dll's. This would open the instrumentation issue to all commers.
116 //
117 // Methods Needed:
118 //    Constructor()
119 //    Initialization();  // For dynamic scenario settups?
120 //    Update();          // Follow the data changes.
121 //    Repaint();         // Respond to uncover/panel repaints.
122 //    Break();           // Show a frown.
123 //    Fix();             // Return to normal appearance and function.
124 //    Night_Day();       // Illumination changes appearance/bitmaps.
125 //
126
127 // CLO 2/21/98 - added to fix compile error
128 typedef struct  {
129   int x;
130   int y;
131 } POINT;
132
133 // CLO 2/21/98 - added to fix compile error
134 typedef struct  {
135   int left;
136   int right;
137   int top;
138   int bottom;
139 } RECT;
140
141 typedef struct  {
142        // Parametric defined members
143   int  type;
144   int  sub_type;
145   int  div_min;
146   int  div_max;
147   int  orientation;
148   int  minimum_value;
149   int  maximum_value;
150   int  width_units;
151   int  modulo;    // for compass, etc. Set to 0 for non_modulo scales.
152
153   double (*load_value)( void );
154
155   // Pre-calculated members.
156   int scr_span;
157   int mid_scr;
158   RECT scrn_pos; // Screen rectangle for inicator
159                  //  Replaces previous parameters as:
160                  //  scr_pos -> left,bottom
161                  //  scr_max -> top, right
162                  //  scr_min -> left,bottom
163   double factor;
164   double half_width_units;
165 }HUD_scale,  *pHUDscale;
166
167 typedef struct  {
168         int type;
169   RECT  position;
170         int div_min;
171         int div_max;
172         int orientation;
173         int label_position;
174         int width_units;
175   int  modulo;  // for compass, etc. Set to 0 for non_modulo scales.
176         double (*load_value)( void );
177 }HUD_circular_scale, *pHUD_circscale;
178
179 typedef struct  {
180         int type;
181   POINT scrn_pos;
182         int scr_width;
183         int scr_height;
184         int scr_hole;
185         int div_units;
186         int label_position;
187         int width_units;
188         double (*load_roll)( void );
189         double (*load_pitch)( void );
190 }HUD_ladder, *pHUDladder;
191
192 typedef struct {
193         int scr_min;
194         int scr_max;
195         int div_min;
196         int div_max;
197         int orientation;
198         int label_position;
199         int width_units;
200         double (*load_value)( void );
201 } HUD_circular_ladder, *pHUDcircladder;
202
203 #define HORIZON_FIXED   1
204 #define HORIZON_MOVING  2
205
206 typedef struct{
207         int type;
208   POINT scrn_pos;
209         int scr_width;
210         int scr_hole;
211         int tee_height;
212         double (*load_roll)( void );
213         double (*load_sideslip)( void );
214 } HUD_horizon, *pHUDhorizon;
215
216 typedef struct {
217   POINT scrn_pos;
218   double(*load_value)(void);
219 } HUD_control_surfaces, *pHUDControlSurfaces;
220
221 typedef struct {
222   POINT scrn_pos;    // ctrl_x, ctrl_y
223   int ctrl_length;
224   int orientation;
225   int alignment;
226   int min_value;
227   int max_value;
228   int width_units;
229   double (*load_value)(void);
230 } HUD_control, *pHUDControl;
231 #define LABEL_COUNTER   1
232 #define LABEL_WARNING   2
233
234 typedef struct {
235         int type;
236   POINT scrn_pos;
237         int size;
238         int blink;
239         int justify;
240         char *pre_str;
241         char *post_str;
242         char *format;
243         double (*load_value)( void ); // pointer to routine to get the data
244 } HUD_label, *pHUDlabel;
245
246 // Removed union HUD_instr_data to evolve this to oop code.
247
248 typedef enum{ HUDno_instr,
249               HUDscale,
250               HUDcirc_scale,
251               HUDladder,
252               HUDcirc_ladder,
253               HUDhorizon,
254               HUDlabel,
255               HUDcontrol_surfaces,
256               HUDcontrol
257               } hudinstype;
258
259 typedef struct HUD_INSTR_STRUCT{
260   hudinstype  type;
261   int sub_type;
262   int orientation;
263   void *instr;   // For now we will cast this pointer accoring to the value
264                  // of the type member.
265   struct HUD_INSTR_STRUCT *next;
266 } HUD_instr, *HIptr;
267
268 typedef struct  {
269         int code;
270         HIptr instruments;
271         int status;
272         int time_of_day;
273         int brightness;
274         int size; // possibly another name for this ? (michele)
275 }HUD, *Hptr;
276
277 Hptr fgHUDInit      ( fgAIRCRAFT *cur_aircraft );
278
279 void fgHUDSetTimeMode( Hptr hud, int time_of_day );
280 void fgHUDSetBrightness( Hptr hud, int brightness );
281
282 Hptr fgHUDAddHorizon( Hptr hud,
283                       int x_pos,
284                       int y_pos,
285                       int length,
286                       int hole_len,
287                       int tee_height,
288                       double (*load_roll)( void ),
289                       double (*load_sideslip)( void ) );
290
291 Hptr fgHUDAddScale  ( Hptr hud,                    \
292                       int type,                    \
293                       int subtype,                 \
294                       int scr_pos,                 \
295                       int scr_min,                 \
296                       int scr_max,                 \
297                       int div_min,                 \
298                       int div_max,                 \
299                       int orientation,             \
300                       int min_value,               \
301                       int max_value,               \
302                       int width_units,             \
303                       int modulus,                 \
304                       double (*load_value)( void ) );
305
306 Hptr fgHUDAddLabel  ( Hptr hud,                    \
307                       int x_pos,                   \
308                       int y_pos,                   \
309                       int size,                    \
310                       int blink,                   \
311                       int justify,                 \
312                       char *pre_str,               \
313                       char *post_str,              \
314                       char *format,                \
315                       double (*load_value)( void ) );
316
317 Hptr fgHUDAddLadder ( Hptr hud,                    \
318                       int x_pos,                   \
319                       int y_pos,                   \
320                       int scr_width,               \
321                       int scr_height,              \
322                       int hole_len,                \
323                       int div_units,               \
324                       int label_pos,               \
325                       int max_value,               \
326                       double (*load_roll)( void ), \
327                       double (*load_pitch)( void ) );
328
329 Hptr fgHUDAddControlSurfaces( Hptr hud,                    \
330                               int x_pos,                   \
331                               int y_pos,                   \
332                               double (*load_value)( void) );
333
334 Hptr fgHUDAddControl( Hptr hud,                    \
335                       int ctrl_x,                  \
336                       int ctrl_y,                  \
337                       int ctrl_length,             \
338                       int orientation,             \
339                       int alignment,               \
340                       int min_value,               \
341                       int max_value,               \
342                       int width_units,             \
343                       double (*load_value)( void) );
344
345 /*
346 Hptr fgHUDAddLadder ( Hptr hud,
347                       int scr_min,
348                       int scr_max,
349                       int div_min,
350                       int div_max, \
351                                                     int orientation,
352                       int max_value,
353                       double *(load_value);
354
355 Hptr fgHUDAddCircularLadder( Hptr hud,
356                              int scr_min,
357                              int scr_max,
358                              int div_min,
359                              int div_max, \
360                                                            int max_value,
361                              double *(load_value) );
362
363 Hptr fgHUDAddNumDisp( Hptr hud,
364                       int x_pos,
365                       int y_pos,
366                       int size,
367                       int blink, \
368                                                     char *pre_str,
369                       char *post_str,
370                       double *(load_value) );
371 */
372
373 void fgUpdateHUD ( Hptr hud );
374 void fgUpdateHUD2( Hptr hud ); // Future use?
375
376
377 #endif // _HUD_H  
378
379 /* $Log$
380 /* Revision 1.14  1998/02/21 14:53:14  curt
381 /* Added Charlie's HUD changes.
382 /*
383  * Revision 1.13  1998/02/20 00:16:22  curt
384  * Thursday's tweaks.
385  *
386  * Revision 1.12  1998/02/19 13:05:52  curt
387  * Incorporated some HUD tweaks from Michelle America.
388  * Tweaked the sky's sunset/rise colors.
389  * Other misc. tweaks.
390  *
391  * Revision 1.11  1998/02/16 13:38:42  curt
392  * Integrated changes from Charlie Hotchkiss.
393  *
394  * Revision 1.10  1998/02/12 21:59:42  curt
395  * Incorporated code changes contributed by Charlie Hotchkiss
396  * <chotchkiss@namg.us.anritsu.com>
397  *
398  * Revision 1.8  1998/02/07 15:29:35  curt
399  * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
400  * <chotchkiss@namg.us.anritsu.com>
401  *
402  * Revision 1.7  1998/02/03 23:20:15  curt
403  * Lots of little tweaks to fix various consistency problems discovered by
404  * Solaris' CC.  Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
405  * passed arguments along to the real printf().  Also incorporated HUD changes
406  * by Michele America.
407  *
408  * Revision 1.6  1998/01/22 02:59:30  curt
409  * Changed #ifdef FILE_H to #ifdef _FILE_H
410  *
411  * Revision 1.5  1998/01/19 19:27:01  curt
412  * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
413  * This should simplify things tremendously.
414  *
415  * Revision 1.4  1998/01/19 18:40:21  curt
416  * Tons of little changes to clean up the code and to remove fatal errors
417  * when building with the c++ compiler.
418  *
419  * Revision 1.3  1997/12/30 16:36:41  curt
420  * Merged in Durk's changes ...
421  *
422  * Revision 1.2  1997/12/10 22:37:40  curt
423  * Prepended "fg" on the name of all global structures that didn't have it yet.
424  * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
425  *
426  * Revision 1.1  1997/08/29 18:03:22  curt
427  * Initial revision.
428  *
429  */