]> git.mxchange.org Git - flightgear.git/blob - Cockpit/hud.h
Prepended "fg" on the name of all global structures that didn't have it yet.
[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 #include "../Aircraft/aircraft.h"
28 #include "../Flight/flight.h"
29 #include "../Controls/controls.h"
30
31
32 /* Instrument types */
33 #define ARTIFICIAL_HORIZON      1
34 #define SCALE                           2
35 #define LADDER                          3
36 #define LABEL                           4
37
38 /* Scale constants */
39 #define HORIZONTAL                      1
40 #define TOP                                     2
41 #define BOTTOM                          3
42 #define VERTICAL                        4
43 #define LEFT                            5
44 #define RIGHT                           6
45 #define LIMIT                           7
46 #define NOLIMIT                         8
47
48 /* Label constants */
49 #define SMALL                           1
50 #define LARGE                           2
51 #define BLINK                           3
52 #define NOBLINK                         4
53 #define LEFT_JUST                       5
54 #define CENTER_JUST                     6
55 #define RIGHT_JUST                      7
56
57 /* Ladder constants */
58 #define NONE                            1
59 #define UPPER_LEFT                      2
60 #define UPPER_CENTER            3
61 #define UPPER_RIGHT                     4
62 #define CENTER_RIGHT            5
63 #define LOWER_RIGHT                     6
64 #define LOWER_CENTER            7
65 #define LOWER_LEFT                      8
66 #define CENTER_LEFT                     9
67 #define SOLID_LINES                     10
68 #define DASHED_LINES            11
69 #define DASHED_NEG_LINES        12
70
71 /* Ladder orientaion */
72 // #define HUD_VERTICAL        1
73 // #define HUD_HORIZONTAL               2
74 // #define HUD_FREEFLOAT                3
75
76 /* Ladder orientation modes */
77 // #define HUD_LEFT             1
78 // #define HUD_RIGHT            2
79 // #define HUD_TOP              1
80 // #define HUD_BOTTOM           2
81 // #define HUD_V_LEFT                   1
82 // #define HUD_V_RIGHT          2
83 // #define HUD_H_TOP            1
84 // #define HUD_H_BOTTOM         2
85
86
87 /* Ladder sub-types */
88 // #define HUD_LIM                              1
89 // #define HUD_NOLIM                    2
90 // #define HUD_CIRC                     3
91
92 // #define HUD_INSTR_LADDER     1
93 // #define HUD_INSTR_CLADDER    2
94 // #define HUD_INSTR_HORIZON    3
95 // #define HUD_INSTR_LABEL              4
96
97 struct HUD_scale {
98         int type;
99         int scr_pos;
100         int scr_min;
101         int scr_max;
102         int div_min;
103         int div_max;
104         int orientation;
105         int with_minimum;
106         int minimum_value;
107         int width_units;
108         double (*load_value)();
109 };
110
111 struct HUD_circular_scale {
112         int type;
113         int scr_pos;
114         int scr_min;
115         int scr_max;
116         int div_min;
117         int div_max;
118         int orientation;
119         int label_position;
120         int width_units;
121         double (*load_value)();
122 };
123
124 struct HUD_ladder {
125         int type;
126         int x_pos;
127         int y_pos;
128         int scr_width;
129         int scr_height;
130         int scr_hole;
131         int div_units;
132         int label_position;
133         int width_units;
134         double (*load_roll)();
135         double (*load_pitch)();
136 };
137
138 struct HUD_circular_ladder {
139         int scr_min;
140         int scr_max;
141         int div_min;
142         int div_max;
143         int orientation;
144         int label_position;
145         int width_units;
146         double (*load_value)();
147 };
148
149 #define HORIZON_FIXED   1
150 #define HORIZON_MOVING  2
151
152 struct HUD_horizon {
153         int type;
154         int x_pos;
155         int y_pos;
156         int scr_width;
157         int scr_hole;
158         double (*load_value)();
159 };
160
161 #define LABEL_COUNTER   1
162 #define LABEL_WARNING   2
163
164 struct HUD_label {
165         int type;
166         int x_pos;
167         int y_pos;
168         int size;
169         int blink;
170         int justify;
171         char *pre_str;
172         char *post_str;
173         char *format;
174         double (*load_value)();
175 };
176
177 union HUD_instr_data {
178         struct HUD_scale scale;
179         struct HUD_circular_scale circ_scale;
180         struct HUD_ladder ladder;
181         struct HUD_circular_ladder circ_ladder;
182         struct HUD_horizon horizon;
183         struct HUD_label label;
184 };
185
186 typedef struct HUD_instr *HIptr;
187
188 struct HUD_instr {
189         int type;
190         int sub_type;
191         int orientation;
192         union HUD_instr_data instr;
193         int color;
194         HIptr next;
195 };
196
197 struct HUD {
198         int code;
199         // struct HUD_instr *instruments;
200         HIptr instruments;
201         int status;
202 };
203
204 typedef struct HUD *Hptr;
205
206 Hptr fgHUDInit( struct fgAIRCRAFT cur_aircraft, int color );
207 Hptr fgHUDAddHorizon( Hptr hud, int x_pos, int y_pos, int length, int hole_len, double (*load_value)() );
208 Hptr fgHUDAddScale( Hptr hud, int type, int scr_pos, int scr_min, int scr_max, int div_min, int div_max, \
209                                         int orientation, int with_min, int min_value, int width_units, double (*load_value)() );
210 Hptr fgHUDAddLabel( Hptr hud, int x_pos, int y_pos, int size, int blink, int justify, \
211                                         char *pre_str, char *post_str, char *format, double (*load_value)() );
212 Hptr fgHUDAddLadder( Hptr hud, int x_pos, int y_pos, int scr_width, int scr_height, \
213                                         int hole_len, int div_units, int label_pos, int max_value, \
214                                         double (*load_roll)(), double (*load_pitch)() );
215                                         
216                                         
217                                         
218 /* struct HUD *fgHUDAddLadder( Hptr hud, int scr_min, int scr_max, int div_min, int div_max, \
219                                         int orientation, int max_value, double *(load_value);
220 struct HUD *fgHUDAddCircularLadder( Hptr hud, int scr_min, int scr_max, int div_min, int div_max, \
221                                         int max_value, double *(load_value) );
222 struct HUD *fgHUDAddNumDisp( Hptr hud, int x_pos, int y_pos, int size, int blink, \
223                                         char *pre_str, char *post_str, double *(load_value) ); */
224 void fgUpdateHUD();
225 void fgUpdateHUD2( struct HUD *hud );
226
227
228 /* $Log$
229 /* Revision 1.2  1997/12/10 22:37:40  curt
230 /* Prepended "fg" on the name of all global structures that didn't have it yet.
231 /* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
232 /*
233  * Revision 1.1  1997/08/29 18:03:22  curt
234  * Initial revision.
235  *
236  */