]> git.mxchange.org Git - flightgear.git/blob - Cockpit/hud.h
0e34464d898cec39ba1c675e485829b28d67b4bb
[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 #define CONTROL_SURFACES                5
42
43 /* Scale constants */
44 #define HORIZONTAL                      1
45 #define TOP                                     2
46 #define BOTTOM                          3
47 #define VERTICAL                        4
48 #define LEFT                            5
49 #define RIGHT                           6
50 #define LIMIT                           7
51 #define NOLIMIT                         8
52
53 /* Label constants */
54 #define SMALL                           1
55 #define LARGE                           2
56 #define BLINK                           3
57 #define NOBLINK                         4
58 #define LEFT_JUST                       5
59 #define CENTER_JUST                     6
60 #define RIGHT_JUST                      7
61
62 /* Ladder constants */
63 #define NONE                            1
64 #define UPPER_LEFT                      2
65 #define UPPER_CENTER            3
66 #define UPPER_RIGHT                     4
67 #define CENTER_RIGHT            5
68 #define LOWER_RIGHT                     6
69 #define LOWER_CENTER            7
70 #define LOWER_LEFT                      8
71 #define CENTER_LEFT                     9
72 #define SOLID_LINES                     10
73 #define DASHED_LINES            11
74 #define DASHED_NEG_LINES        12
75
76 /* Ladder orientaion */
77 // #define HUD_VERTICAL        1
78 // #define HUD_HORIZONTAL               2
79 // #define HUD_FREEFLOAT                3
80
81 /* Ladder orientation modes */
82 // #define HUD_LEFT             1
83 // #define HUD_RIGHT            2
84 // #define HUD_TOP              1
85 // #define HUD_BOTTOM           2
86 // #define HUD_V_LEFT                   1
87 // #define HUD_V_RIGHT          2
88 // #define HUD_H_TOP            1
89 // #define HUD_H_BOTTOM         2
90
91
92 /* Ladder sub-types */
93 // #define HUD_LIM                              1
94 // #define HUD_NOLIM                    2
95 // #define HUD_CIRC                     3
96
97 // #define HUD_INSTR_LADDER     1
98 // #define HUD_INSTR_CLADDER    2
99 // #define HUD_INSTR_HORIZON    3
100 // #define HUD_INSTR_LABEL              4
101
102 struct HUD_scale {
103         int type;
104         int scr_pos;
105         int scr_min;
106         int scr_max;
107         int div_min;
108         int div_max;
109         int orientation;
110         int with_minimum;
111         int minimum_value;
112         int width_units;
113         double (*load_value)( void );
114 };
115
116 struct HUD_circular_scale {
117         int 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 label_position;
125         int width_units;
126         double (*load_value)( void );
127 };
128
129 struct HUD_ladder {
130         int type;
131         int x_pos;
132         int y_pos;
133         int scr_width;
134         int scr_height;
135         int scr_hole;
136         int div_units;
137         int label_position;
138         int width_units;
139         double (*load_roll)( void );
140         double (*load_pitch)( void );
141 };
142
143 struct HUD_circular_ladder {
144         int scr_min;
145         int scr_max;
146         int div_min;
147         int div_max;
148         int orientation;
149         int label_position;
150         int width_units;
151         double (*load_value)( void );
152 };
153
154 #define HORIZON_FIXED   1
155 #define HORIZON_MOVING  2
156
157 struct HUD_horizon {
158         int type;
159         int x_pos;
160         int y_pos;
161         int scr_width;
162         int scr_hole;
163         double (*load_value)( void );
164 };
165
166 struct HUD_control_surfaces {
167         int type;
168         int x_pos;
169         int y_pos;
170         double (*load_value)();
171 };
172
173 #define LABEL_COUNTER   1
174 #define LABEL_WARNING   2
175
176 struct HUD_label {
177         int type;
178         int x_pos;
179         int y_pos;
180         int size;
181         int blink;
182         int justify;
183         char *pre_str;
184         char *post_str;
185         char *format;
186         double (*load_value)( void );
187 };
188
189 union HUD_instr_data {
190         struct HUD_scale scale;
191         struct HUD_circular_scale circ_scale;
192         struct HUD_ladder ladder;
193         struct HUD_circular_ladder circ_ladder;
194         struct HUD_horizon horizon;
195         struct HUD_label label;
196         struct HUD_control_surfaces control_surfaces;
197 };
198
199 typedef struct HUD_instr *HIptr;
200
201 struct HUD_instr {
202         int type;
203         int sub_type;
204         int orientation;
205         union HUD_instr_data instr;
206         int color;
207         HIptr next;
208 };
209
210 struct HUD {
211         int code;
212         // struct HUD_instr *instruments;
213         HIptr instruments;
214         int status;
215 };
216
217 typedef struct HUD *Hptr;
218
219 Hptr fgHUDInit( struct fgAIRCRAFT cur_aircraft, int color );
220 Hptr fgHUDAddHorizon( Hptr hud, int x_pos, int y_pos, int length, int hole_len, double (*load_value)( void ) );
221 Hptr fgHUDAddScale( Hptr hud, int type, int scr_pos, int scr_min, int scr_max, int div_min, int div_max, \
222                                         int orientation, int with_min, int min_value, int width_units, double (*load_value)( void ) );
223 Hptr fgHUDAddLabel( Hptr hud, int x_pos, int y_pos, int size, int blink, int justify, \
224                                         char *pre_str, char *post_str, char *format, double (*load_value)( void ) );
225 Hptr fgHUDAddLadder( Hptr hud, int x_pos, int y_pos, int scr_width, int scr_height, \
226                                         int hole_len, int div_units, int label_pos, int max_value, \
227                                         double (*load_roll)( void ), double (*load_pitch)( void ) );
228 Hptr fgHUDAddControlSurfaces( Hptr hud, int x_pos, int y_pos, double (*get_heading)() );                                        
229                                         
230                                         
231 /* struct HUD *fgHUDAddLadder( Hptr hud, int scr_min, int scr_max, int div_min, int div_max, \
232                                         int orientation, int max_value, double *(load_value);
233 struct HUD *fgHUDAddCircularLadder( Hptr hud, int scr_min, int scr_max, int div_min, int div_max, \
234                                         int max_value, double *(load_value) );
235 struct HUD *fgHUDAddNumDisp( Hptr hud, int x_pos, int y_pos, int size, int blink, \
236                                         char *pre_str, char *post_str, double *(load_value) ); */
237 void fgUpdateHUD( Hptr hud );
238 void fgUpdateHUD2( struct HUD *hud );
239
240
241 #endif /* _HUD_H */
242
243
244 /* $Log$
245 /* Revision 1.7  1998/02/03 23:20:15  curt
246 /* Lots of little tweaks to fix various consistency problems discovered by
247 /* Solaris' CC.  Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
248 /* passed arguments along to the real printf().  Also incorporated HUD changes
249 /* by Michele America.
250 /*
251  * Revision 1.6  1998/01/22 02:59:30  curt
252  * Changed #ifdef FILE_H to #ifdef _FILE_H
253  *
254  * Revision 1.5  1998/01/19 19:27:01  curt
255  * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
256  * This should simplify things tremendously.
257  *
258  * Revision 1.4  1998/01/19 18:40:21  curt
259  * Tons of little changes to clean up the code and to remove fatal errors
260  * when building with the c++ compiler.
261  *
262  * Revision 1.3  1997/12/30 16:36:41  curt
263  * Merged in Durk's changes ...
264  *
265  * Revision 1.2  1997/12/10 22:37:40  curt
266  * Prepended "fg" on the name of all global structures that didn't have it yet.
267  * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
268  *
269  * Revision 1.1  1997/08/29 18:03:22  curt
270  * Initial revision.
271  *
272  */