1 // panel.cxx - default, 2D single-engine prop instrument panel
3 // Written by David Megginson, started January 2000.
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of the
8 // License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 # error This library requires C++
38 #include <simgear/xgl.h>
42 class FGPanelInstrument;
46 ////////////////////////////////////////////////////////////////////////
47 // Instrument panel class.
48 ////////////////////////////////////////////////////////////////////////
56 // Legacy interface from old panel.
57 static FGPanel * OurPanel;
58 virtual float get_height () const;
59 virtual void ReInit (int x, int y, int finx, int finy);
60 virtual void Update () const;
68 const FGPanelInstrument * _airspeed;
69 const FGPanelInstrument * _horizon;
70 const FGPanelInstrument * _altimeter;
71 const FGPanelInstrument * _coordinator;
72 const FGPanelInstrument * _gyro;
73 const FGPanelInstrument * _vertical;
74 const FGPanelInstrument * _flaps;
75 const FGPanelInstrument * _rpm;
80 ////////////////////////////////////////////////////////////////////////
81 // Instrument base class.
82 ////////////////////////////////////////////////////////////////////////
84 class FGPanelInstrument
88 FGPanelInstrument (int x, int y, int w, int h);
89 virtual ~FGPanelInstrument ();
91 virtual void draw () const = 0;
93 virtual void setPosition(int x, int y);
94 virtual void setSize(int w, int h);
96 virtual int getXPos () const;
97 virtual int getYPos () const;
105 ////////////////////////////////////////////////////////////////////////
106 // An instrument composed of layered textures.
107 ////////////////////////////////////////////////////////////////////////
109 class FGTexturedInstrument : public FGPanelInstrument
112 static const int MAX_LAYERS = 8;
113 FGTexturedInstrument (int x, int y, int w, int h);
114 virtual ~FGTexturedInstrument ();
116 virtual void addLayer (int layer, const char * textureName);
117 virtual void addLayer (int layer, ssgTexture * texture);
118 virtual void setLayerCenter (int layer, int x, int y);
119 virtual void setLayerRot (int layer, double rotation) const;
120 virtual void setLayerOffset (int layer, int xoffset, int yoffset) const;
121 virtual bool hasLayer (int layer) const;
123 virtual void draw () const;
125 bool _layers[MAX_LAYERS];
126 mutable int _xcenter[MAX_LAYERS];
127 mutable int _ycenter[MAX_LAYERS];
128 mutable double _rotation[MAX_LAYERS];
129 mutable int _xoffset[MAX_LAYERS];
130 mutable int _yoffset[MAX_LAYERS];
131 ssgTexture * _textures[MAX_LAYERS];
136 ////////////////////////////////////////////////////////////////////////
137 // Airspeed indicator.
138 ////////////////////////////////////////////////////////////////////////
140 class FGAirspeedIndicator : public FGTexturedInstrument
143 FGAirspeedIndicator (int x, int y);
144 virtual ~FGAirspeedIndicator ();
145 virtual void draw () const;
150 ////////////////////////////////////////////////////////////////////////
151 // Artificial Horizon.
152 ////////////////////////////////////////////////////////////////////////
154 class FGHorizon : public FGTexturedInstrument
157 FGHorizon (int x, int y);
158 virtual ~FGHorizon ();
159 virtual void draw () const;
164 ////////////////////////////////////////////////////////////////////////
166 ////////////////////////////////////////////////////////////////////////
168 class FGAltimeter : public FGTexturedInstrument
171 FGAltimeter (int x, int y);
172 virtual ~FGAltimeter ();
173 virtual void draw () const;
178 ////////////////////////////////////////////////////////////////////////
179 // Turn Co-ordinator.
180 ////////////////////////////////////////////////////////////////////////
182 class FGTurnCoordinator : public FGTexturedInstrument
185 FGTurnCoordinator (int x, int y);
186 virtual ~FGTurnCoordinator ();
187 virtual void draw () const;
192 ////////////////////////////////////////////////////////////////////////
194 ////////////////////////////////////////////////////////////////////////
196 class FGGyroCompass : public FGTexturedInstrument
199 FGGyroCompass (int x, int y);
200 virtual ~FGGyroCompass ();
201 virtual void draw () const;
206 ////////////////////////////////////////////////////////////////////////
207 // Vertical velocity indicator.
208 ////////////////////////////////////////////////////////////////////////
210 class FGVerticalVelocity : public FGTexturedInstrument
213 FGVerticalVelocity (int x, int y);
214 virtual ~FGVerticalVelocity ();
215 virtual void draw () const;
220 ////////////////////////////////////////////////////////////////////////
222 ////////////////////////////////////////////////////////////////////////
224 class FGRPMGauge : public FGTexturedInstrument
227 FGRPMGauge (int x, int y);
228 virtual ~FGRPMGauge ();
229 virtual void draw () const;
234 ////////////////////////////////////////////////////////////////////////
235 // Flap position indicator.
236 ////////////////////////////////////////////////////////////////////////
238 class FGFlapIndicator : public FGTexturedInstrument
241 FGFlapIndicator (int x, int y);
242 virtual ~FGFlapIndicator ();
243 virtual void draw () const;
248 #endif // __PANEL_HXX