]> git.mxchange.org Git - flightgear.git/blob - Cockpit/hud.h
Incorporated code changes contributed by Charlie Hotchkiss
[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 with_minimum;
129   int minimum_value;
130   int maximum_value;
131   int width_units;
132   double (*load_value)( void );
133 }HUD_scale,  *pHUDscale;
134
135 typedef struct  {
136         int type;
137         int scr_pos;
138         int scr_min;
139         int scr_max;
140         int div_min;
141         int div_max;
142         int orientation;
143         int label_position;
144         int width_units;
145         double (*load_value)( void );
146 }HUD_circular_scale, *pHUD_circscale;
147
148 typedef struct  {
149         int type;
150         int x_pos;
151         int y_pos;
152         int scr_width;
153         int scr_height;
154         int scr_hole;
155         int div_units;
156         int label_position;
157         int width_units;
158         double (*load_roll)( void );
159         double (*load_pitch)( void );
160 }HUD_ladder, *pHUDladder;
161
162 typedef struct {
163         int scr_min;
164         int scr_max;
165         int div_min;
166         int div_max;
167         int orientation;
168         int label_position;
169         int width_units;
170         double (*load_value)( void );
171 } HUD_circular_ladder, *pHUDcircladder;
172
173 #define HORIZON_FIXED   1
174 #define HORIZON_MOVING  2
175
176 typedef struct{
177         int type;
178         int x_pos;
179         int y_pos;
180         int scr_width;
181         int scr_hole;
182         double (*load_value)( void );
183 } HUD_horizon, *pHUDhorizon;
184
185 typedef struct {
186         int type;
187         int x_pos;
188         int y_pos;
189         double (*load_value)();
190 } HUD_control_surfaces, *pHUDControlSurface;
191 #define LABEL_COUNTER   1
192 #define LABEL_WARNING   2
193
194 typedef struct {
195         int type;
196         int x_pos;
197         int y_pos;
198         int size;
199         int blink;
200         int justify;
201         char *pre_str;
202         char *post_str;
203         char *format;
204         double (*load_value)( void ); // pointer to routine to get the data
205 } HUD_label, *pHUDlabel;
206
207 // Removed union HUD_instr_data to evolve this to oop code.
208
209 typedef enum{ HUDno_instr,
210                    HUDscale,
211                    HUDcirc_scale,
212                    HUDladder,
213                    HUDcirc_ladder,
214                    HUDhorizon,
215                    HUDlabel,
216                    HUDcontrols
217                    } hudinstype;
218
219 typedef struct HUD_INSTR_STRUCT{
220   hudinstype  type;
221   int sub_type;
222   int orientation;
223   void *instr;   // For now we will cast this pointer accoring to the value
224                  // of the type member.
225   struct HUD_INSTR_STRUCT *next;
226 } HUD_instr, *HIptr;
227
228 typedef struct  {
229         int code;
230         HIptr instruments;
231         int status;
232 }HUD, *Hptr;
233
234 Hptr fgHUDInit      ( fgAIRCRAFT *cur_aircraft );
235
236 Hptr fgHUDAddHorizon( Hptr hud,
237                       int x_pos,
238                       int y_pos,
239                       int length,
240                       int hole_len,
241                       double (*load_value)( void ) );
242
243 Hptr fgHUDAddScale  ( Hptr hud,                    \
244                       int type,                    \
245                       int subtype,                 \
246                       int scr_pos,                 \
247                       int scr_min,                 \
248                       int scr_max,                 \
249                       int div_min,                 \
250                       int div_max,                 \
251                       int orientation,             \
252                       int with_min,                \
253                       int min_value,               \
254                       int max_value,               \
255                       int width_units,             \
256                       double (*load_value)( void ) );
257
258 Hptr fgHUDAddLabel  ( Hptr hud,                    \
259                       int x_pos,                   \
260                       int y_pos,                   \
261                       int size,                    \
262                       int blink,                   \
263                       int justify,                 \
264                       char *pre_str,               \
265                       char *post_str,              \
266                       char *format,                \
267                       double (*load_value)( void ) );
268
269 Hptr fgHUDAddLadder ( Hptr hud,                    \
270                       int x_pos,                   \
271                       int y_pos,                   \
272                       int scr_width,               \
273                       int scr_height,              \
274                       int hole_len,                \
275                       int div_units,               \
276                       int label_pos,               \
277                       int max_value,               \
278                       double (*load_roll)( void ), \
279                       double (*load_pitch)( void ) );
280
281 Hptr fgHUDAddControlSurfaces( Hptr hud,
282                               int x_pos,
283                               int y_pos,
284                               double (*load_value)(void) );
285
286 /*
287 Hptr fgHUDAddLadder ( Hptr hud,
288                       int scr_min,
289                       int scr_max,
290                       int div_min,
291                       int div_max, \
292                                                     int orientation,
293                       int max_value,
294                       double *(load_value);
295
296 Hptr fgHUDAddCircularLadder( Hptr hud,
297                              int scr_min,
298                              int scr_max,
299                              int div_min,
300                              int div_max, \
301                                                            int max_value,
302                              double *(load_value) );
303
304 Hptr fgHUDAddNumDisp( Hptr hud,
305                       int x_pos,
306                       int y_pos,
307                       int size,
308                       int blink, \
309                                                     char *pre_str,
310                       char *post_str,
311                       double *(load_value) );
312 */
313
314 void fgUpdateHUD ( Hptr hud );
315 void fgUpdateHUD2( Hptr hud ); // Future use?
316
317
318 #endif // _HUD_H  
319
320 /* $Log$
321 /* Revision 1.10  1998/02/12 21:59:42  curt
322 /* Incorporated code changes contributed by Charlie Hotchkiss
323 /* <chotchkiss@namg.us.anritsu.com>
324 /*
325  * Revision 1.8  1998/02/07 15:29:35  curt
326  * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
327  * <chotchkiss@namg.us.anritsu.com>
328  *
329  * Revision 1.7  1998/02/03 23:20:15  curt
330  * Lots of little tweaks to fix various consistency problems discovered by
331  * Solaris' CC.  Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
332  * passed arguments along to the real printf().  Also incorporated HUD changes
333  * by Michele America.
334  *
335  * Revision 1.6  1998/01/22 02:59:30  curt
336  * Changed #ifdef FILE_H to #ifdef _FILE_H
337  *
338  * Revision 1.5  1998/01/19 19:27:01  curt
339  * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
340  * This should simplify things tremendously.
341  *
342  * Revision 1.4  1998/01/19 18:40:21  curt
343  * Tons of little changes to clean up the code and to remove fatal errors
344  * when building with the c++ compiler.
345  *
346  * Revision 1.3  1997/12/30 16:36:41  curt
347  * Merged in Durk's changes ...
348  *
349  * Revision 1.2  1997/12/10 22:37:40  curt
350  * Prepended "fg" on the name of all global structures that didn't have it yet.
351  * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
352  *
353  * Revision 1.1  1997/08/29 18:03:22  curt
354  * Initial revision.
355  *
356  */