]> git.mxchange.org Git - flightgear.git/blob - Cockpit/cockpit.cxx
2cdbfbcc6ff7169064e044dcdb8ffc0a94826350
[flightgear.git] / Cockpit / cockpit.cxx
1 /**************************************************************************
2  * cockpit.c -- routines to draw a cockpit (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 #ifdef HAVE_CONFIG_H
28 #  include <config.h>
29 #endif
30
31 #ifdef HAVE_WINDOWS_H          
32 #  include <windows.h>
33 #endif
34
35 #include <GL/glut.h>
36
37 #include <stdlib.h>
38
39 #include <Include/fg_constants.h>
40
41 #include <Aircraft/aircraft.h>
42 #include <Debug/fg_debug.h>
43 #include <Math/fg_random.h>
44 #include <Math/mat3.h>
45 #include <Math/polar.h>
46 #include <Scenery/scenery.h>
47 #include <Time/fg_timer.hxx>
48 #include <Weather/weather.h>
49
50 #include "cockpit.hxx"
51
52 // This is a structure that contains all data related to
53 // cockpit/panel/hud system
54
55 static fgCOCKPIT *aircraft_cockpit;
56
57 fgCOCKPIT *fgCockpitInit( fgAIRCRAFT *cur_aircraft )
58 {
59         fgCOCKPIT *cockpit;
60         Hptr hud;
61
62         fgPrintf( FG_COCKPIT, FG_INFO, "Initializing cockpit subsystem\n");
63
64         cockpit = (fgCOCKPIT *)calloc(sizeof(fgCOCKPIT),1);
65         if( cockpit == NULL )
66                 return( NULL );
67
68         cockpit->code = 1;      /* It will be aircraft dependent */
69         cockpit->status = 0;
70
71         // If aircraft has HUD
72         hud = fgHUDInit( cur_aircraft );  // Color no longer in parameter list
73         if( hud == NULL )
74                 return( NULL );
75
76         cockpit->hud = hud;
77
78         aircraft_cockpit = cockpit;
79
80         fgPrintf( FG_COCKPIT, FG_INFO,
81                   "  Code %d  Status %d\n", 
82                   cockpit->hud->code, cockpit->hud->status );
83
84         return( cockpit );
85 }
86
87 fgCOCKPIT *fgCockpitAddHUD( fgCOCKPIT *cockpit, HUD *hud )
88 {
89         cockpit->hud = hud;
90         return(cockpit);
91 }
92
93 void fgCockpitUpdate( void )
94 {
95
96         fgPrintf( FG_COCKPIT, FG_DEBUG,
97                   "Cockpit: code %d   status %d\n", 
98                   aircraft_cockpit->code, aircraft_cockpit->status );
99         if( aircraft_cockpit->hud != NULL ) {
100             // That is, if the aircraft has a HUD, then draw it.
101             fgUpdateHUD( aircraft_cockpit->hud );
102         }
103 }
104
105
106 /* $Log$
107 /* Revision 1.1  1998/04/24 00:45:54  curt
108 /* C++-ifing the code a bit.
109 /*
110  * Revision 1.13  1998/04/18 04:14:01  curt
111  * Moved fg_debug.c to it's own library.
112  *
113  * Revision 1.12  1998/04/14 02:23:09  curt
114  * Code reorganizations.  Added a Lib/ directory for more general libraries.
115  *
116  * Revision 1.11  1998/03/14 00:32:13  curt
117  * Changed a printf() to a fgPrintf().
118  *
119  * Revision 1.10  1998/02/07 15:29:33  curt
120  * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
121  * <chotchkiss@namg.us.anritsu.com>
122  *
123  * Revision 1.9  1998/02/03 23:20:14  curt
124  * Lots of little tweaks to fix various consistency problems discovered by
125  * Solaris' CC.  Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
126  * passed arguments along to the real printf().  Also incorporated HUD changes
127  * by Michele America.
128  *
129  * Revision 1.8  1998/01/31 00:43:03  curt
130  * Added MetroWorks patches from Carmen Volpe.
131  *
132  * Revision 1.7  1998/01/27 00:47:51  curt
133  * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
134  * system and commandline/config file processing code.
135  *
136  * Revision 1.6  1998/01/19 19:27:01  curt
137  * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
138  * This should simplify things tremendously.
139  *
140  * Revision 1.5  1998/01/19 18:40:19  curt
141  * Tons of little changes to clean up the code and to remove fatal errors
142  * when building with the c++ compiler.
143  *
144  * Revision 1.4  1997/12/30 20:47:34  curt
145  * Integrated new event manager with subsystem initializations.
146  *
147  * Revision 1.3  1997/12/15 23:54:33  curt
148  * Add xgl wrappers for debugging.
149  * Generate terrain normals on the fly.
150  *
151  * Revision 1.2  1997/12/10 22:37:38  curt
152  * Prepended "fg" on the name of all global structures that didn't have it yet.
153  * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
154  *
155  * Revision 1.1  1997/08/29 18:03:20  curt
156  * Initial revision.
157  *
158  */