]> git.mxchange.org Git - flightgear.git/blob - Cockpit/hud.h
08cf5225dd9fa65e70ee2e5f5fa42f1d5e8b7470
[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
31 #include <Aircraft/aircraft.h>
32 #include <Flight/flight.h>
33 #include <Controls/controls.h>
34
35 // View mode definitions
36
37 enum VIEW_MODES { HUD_VIEW, PANEL_VIEW, CHASE_VIEW, TOWER_VIEW };
38
39 // Instrument types
40 #define ARTIFICIAL_HORIZON      1
41 #define SCALE              2
42 #define LADDER             3
43 #define LABEL              4
44
45 // Scale constants
46 #define HORIZONTAL         1
47 #define TOP                2
48 #define BOTTOM             3
49 #define VERTICAL           4
50 #define LEFT               5
51 #define RIGHT              6
52 #define LIMIT              7
53 #define NOLIMIT            8
54 #define ROUNDROB           9
55
56 // Label constants
57 #define SMALL              1
58 #define LARGE              2
59 #define BLINK              3
60 #define NOBLINK            4
61 #define LEFT_JUST          5
62 #define CENTER_JUST        6
63 #define RIGHT_JUST         7
64
65 // Ladder constants
66 #define NONE               1
67 #define UPPER_LEFT         2
68 #define UPPER_CENTER       3
69 #define UPPER_RIGHT        4
70 #define CENTER_RIGHT       5
71 #define LOWER_RIGHT        6
72 #define LOWER_CENTER       7
73 #define LOWER_LEFT         8
74 #define CENTER_LEFT        9
75 #define SOLID_LINES       10
76 #define DASHED_LINES      11
77 #define DASHED_NEG_LINES  12
78
79 // Ladder orientaion
80 // #define HUD_VERTICAL        1
81 // #define HUD_HORIZONTAL               2
82 // #define HUD_FREEFLOAT                3
83
84 // Ladder orientation modes
85 // #define HUD_LEFT             1
86 // #define HUD_RIGHT            2
87 // #define HUD_TOP              1
88 // #define HUD_BOTTOM           2
89 // #define HUD_V_LEFT                   1
90 // #define HUD_V_RIGHT          2
91 // #define HUD_H_TOP            1
92 // #define HUD_H_BOTTOM         2
93
94
95 // Ladder sub-types
96 // #define HUD_LIM                              1
97 // #define HUD_NOLIM                    2
98 // #define HUD_CIRC                     3
99
100 // #define HUD_INSTR_LADDER     1
101 // #define HUD_INSTR_CLADDER    2
102 // #define HUD_INSTR_HORIZON    3
103 // #define HUD_INSTR_LABEL              4
104
105 // The following structs will become classes with a derivation from
106 // an ABC instrument_pack. Eventually the instruments may well become
107 // dll's. This would open the instrumentation issue to all commers.
108 //
109 // Methods Needed:
110 //    Constructor()
111 //    Initialization();  // For dynamic scenario settups?
112 //    Update();          // Follow the data changes.
113 //    Repaint();         // Respond to uncover/panel repaints.
114 //    Break();           // Show a frown.
115 //    Fix();             // Return to normal appearance and function.
116 //    Night_Day();       // Illumination changes appearance/bitmaps.
117 //
118
119 typedef struct  {
120   int type;
121   int sub_type;
122   int scr_pos;
123   int scr_min;
124   int scr_max;
125   int div_min;
126   int div_max;
127   int orientation;
128   int minimum_value;
129   int maximum_value;
130   int width_units;
131   double (*load_value)( void );
132 }HUD_scale,  *pHUDscale;
133
134 typedef struct  {
135         int type;
136         int scr_pos;
137         int scr_min;
138         int scr_max;
139         int div_min;
140         int div_max;
141         int orientation;
142         int label_position;
143         int width_units;
144         double (*load_value)( void );
145 }HUD_circular_scale, *pHUD_circscale;
146
147 typedef struct  {
148         int type;
149         int x_pos;
150         int y_pos;
151         int scr_width;
152         int scr_height;
153         int scr_hole;
154         int div_units;
155         int label_position;
156         int width_units;
157         double (*load_roll)( void );
158         double (*load_pitch)( void );
159 }HUD_ladder, *pHUDladder;
160
161 typedef struct {
162         int scr_min;
163         int scr_max;
164         int div_min;
165         int div_max;
166         int orientation;
167         int label_position;
168         int width_units;
169         double (*load_value)( void );
170 } HUD_circular_ladder, *pHUDcircladder;
171
172 #define HORIZON_FIXED   1
173 #define HORIZON_MOVING  2
174
175 typedef struct{
176         int type;
177         int x_pos;
178         int y_pos;
179         int scr_width;
180         int scr_hole;
181         double (*load_value)( void );
182 } HUD_horizon, *pHUDhorizon;
183
184 typedef struct {
185   int x_pos;
186   int y_pos;
187   double(*load_value)(void);
188 } HUD_control_surfaces, *pHUDControlSurfaces;
189
190 typedef struct {
191   int ctrl_x;
192   int ctrl_y;
193   int ctrl_length;
194   int orientation;
195   int alignment;
196   int min_value;
197   int max_value;
198   int width_units;
199   double (*load_value)(void);
200 } HUD_control, *pHUDControl;
201 #define LABEL_COUNTER   1
202 #define LABEL_WARNING   2
203
204 typedef struct {
205         int type;
206         int x_pos;
207         int y_pos;
208         int size;
209         int blink;
210         int justify;
211         char *pre_str;
212         char *post_str;
213         char *format;
214         double (*load_value)( void ); // pointer to routine to get the data
215 } HUD_label, *pHUDlabel;
216
217 // Removed union HUD_instr_data to evolve this to oop code.
218
219 typedef enum{ HUDno_instr,
220                    HUDscale,
221                    HUDcirc_scale,
222                    HUDladder,
223                    HUDcirc_ladder,
224                    HUDhorizon,
225                    HUDlabel,
226                    HUDcontrol_surfaces,
227                    HUDcontrol
228                    } hudinstype;
229
230 typedef struct HUD_INSTR_STRUCT{
231   hudinstype  type;
232   int sub_type;
233   int orientation;
234   void *instr;   // For now we will cast this pointer accoring to the value
235                  // of the type member.
236   struct HUD_INSTR_STRUCT *next;
237 } HUD_instr, *HIptr;
238
239 typedef struct  {
240         int code;
241         HIptr instruments;
242         int status;
243 }HUD, *Hptr;
244
245 Hptr fgHUDInit      ( fgAIRCRAFT *cur_aircraft );
246
247 Hptr fgHUDAddHorizon( Hptr hud,
248                       int x_pos,
249                       int y_pos,
250                       int length,
251                       int hole_len,
252                       double (*load_value)( void ) );
253
254 Hptr fgHUDAddScale  ( Hptr hud,                    \
255                       int type,                    \
256                       int subtype,                 \
257                       int scr_pos,                 \
258                       int scr_min,                 \
259                       int scr_max,                 \
260                       int div_min,                 \
261                       int div_max,                 \
262                       int orientation,             \
263                       int min_value,               \
264                       int max_value,               \
265                       int width_units,             \
266                       double (*load_value)( void ) );
267
268 Hptr fgHUDAddLabel  ( Hptr hud,                    \
269                       int x_pos,                   \
270                       int y_pos,                   \
271                       int size,                    \
272                       int blink,                   \
273                       int justify,                 \
274                       char *pre_str,               \
275                       char *post_str,              \
276                       char *format,                \
277                       double (*load_value)( void ) );
278
279 Hptr fgHUDAddLadder ( Hptr hud,                    \
280                       int x_pos,                   \
281                       int y_pos,                   \
282                       int scr_width,               \
283                       int scr_height,              \
284                       int hole_len,                \
285                       int div_units,               \
286                       int label_pos,               \
287                       int max_value,               \
288                       double (*load_roll)( void ), \
289                       double (*load_pitch)( void ) );
290
291 Hptr fgHUDAddControlSurfaces( Hptr hud,                    \
292                               int x_pos,                   \
293                               int y_pos,                   \
294                               double (*load_value)( void) );
295
296 Hptr fgHUDAddControl( Hptr hud,                    \
297                       int ctrl_x,                  \
298                       int ctrl_y,                  \
299                       int ctrl_length,             \
300                       int orientation,             \
301                       int alignment,               \
302                       int min_value,               \
303                       int max_value,               \
304                       int width_units,             \
305                       double (*load_value)( void) );
306
307 /*
308 Hptr fgHUDAddLadder ( Hptr hud,
309                       int scr_min,
310                       int scr_max,
311                       int div_min,
312                       int div_max, \
313                                                     int orientation,
314                       int max_value,
315                       double *(load_value);
316
317 Hptr fgHUDAddCircularLadder( Hptr hud,
318                              int scr_min,
319                              int scr_max,
320                              int div_min,
321                              int div_max, \
322                                                            int max_value,
323                              double *(load_value) );
324
325 Hptr fgHUDAddNumDisp( Hptr hud,
326                       int x_pos,
327                       int y_pos,
328                       int size,
329                       int blink, \
330                                                     char *pre_str,
331                       char *post_str,
332                       double *(load_value) );
333 */
334
335 void fgUpdateHUD ( Hptr hud );
336 void fgUpdateHUD2( Hptr hud ); // Future use?
337
338
339 #endif // _HUD_H  
340
341 /* $Log$
342 /* Revision 1.11  1998/02/16 13:38:42  curt
343 /* Integrated changes from Charlie Hotchkiss.
344 /*
345  * Revision 1.10  1998/02/12 21:59:42  curt
346  * Incorporated code changes contributed by Charlie Hotchkiss
347  * <chotchkiss@namg.us.anritsu.com>
348  *
349  * Revision 1.8  1998/02/07 15:29:35  curt
350  * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
351  * <chotchkiss@namg.us.anritsu.com>
352  *
353  * Revision 1.7  1998/02/03 23:20:15  curt
354  * Lots of little tweaks to fix various consistency problems discovered by
355  * Solaris' CC.  Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
356  * passed arguments along to the real printf().  Also incorporated HUD changes
357  * by Michele America.
358  *
359  * Revision 1.6  1998/01/22 02:59:30  curt
360  * Changed #ifdef FILE_H to #ifdef _FILE_H
361  *
362  * Revision 1.5  1998/01/19 19:27:01  curt
363  * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
364  * This should simplify things tremendously.
365  *
366  * Revision 1.4  1998/01/19 18:40:21  curt
367  * Tons of little changes to clean up the code and to remove fatal errors
368  * when building with the c++ compiler.
369  *
370  * Revision 1.3  1997/12/30 16:36:41  curt
371  * Merged in Durk's changes ...
372  *
373  * Revision 1.2  1997/12/10 22:37:40  curt
374  * Prepended "fg" on the name of all global structures that didn't have it yet.
375  * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
376  *
377  * Revision 1.1  1997/08/29 18:03:22  curt
378  * Initial revision.
379  *
380  */