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