]> git.mxchange.org Git - flightgear.git/blob - Cockpit/cockpit.c
Prepended "fg" on the name of all global structures that didn't have it yet.
[flightgear.git] / Cockpit / cockpit.c
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 #include <GL/glut.h>
28
29 #include <stdlib.h>
30 #include "cockpit.h"
31
32 #include "../constants.h"
33
34 #include "../Aircraft/aircraft.h"
35 #include "../Scenery/mesh.h"
36 #include "../Scenery/scenery.h"
37 #include "../Math/mat3.h"
38 #include "../Math/polar.h"
39 #include "../Time/fg_timer.h"
40 #include "../Math/fg_random.h"
41 #include "../Weather/weather.h"
42
43 // #define DEBUG
44
45 /* This is a structure that contains all data related to cockpit/panel/hud system */
46 static struct fgCOCKPIT *aircraft_cockpit;
47
48 struct fgCOCKPIT *fgCockpitInit( struct fgAIRCRAFT cur_aircraft )
49 {
50         struct fgCOCKPIT *cockpit;
51         Hptr hud;
52         
53         cockpit = (struct fgCOCKPIT *)calloc(sizeof(struct fgCOCKPIT),1);
54         if( cockpit == NULL )
55                 return( NULL );
56                 
57         cockpit->code = 1234;
58         cockpit->status = 0;
59         
60         /* If aircraft has HUD */
61         hud = fgHUDInit( cur_aircraft, 3 );
62         if( hud == NULL )
63                 return( NULL );
64         
65         cockpit->hud = hud;
66         
67         aircraft_cockpit = cockpit;
68         
69         printf( "Code %d  Status %d\n", cockpit->hud->code, cockpit->hud->status );
70                 
71         return( cockpit );
72 }
73
74 struct fgCOCKPIT *fgCockpitAddHUD( struct fgCOCKPIT *cockpit, struct HUD *hud )
75 {
76         cockpit->hud = hud;
77 }
78
79 void fgCockpitUpdate()
80 {
81
82         printf( "Cockpit: code %d   status %d\n", aircraft_cockpit->code, aircraft_cockpit->status );
83         if( aircraft_cockpit->hud != NULL )                     // That is, if the aircraft has a HUD,
84                 fgUpdateHUD( aircraft_cockpit->hud );   // then draw it.
85                 
86 }
87
88
89 /* $Log$
90 /* Revision 1.2  1997/12/10 22:37:38  curt
91 /* Prepended "fg" on the name of all global structures that didn't have it yet.
92 /* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
93 /*
94  * Revision 1.1  1997/08/29 18:03:20  curt
95  * Initial revision.
96  *
97  */