2000-02-15 03:30:01 +00:00
|
|
|
|
// panel.cxx - default, 2D single-engine prop instrument panel
|
|
|
|
|
//
|
|
|
|
|
// Written by David Megginson, started January 2000.
|
1999-12-23 17:37:18 +00:00
|
|
|
|
//
|
1999-01-07 19:25:53 +00:00
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
// General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
1998-11-11 00:19:27 +00:00
|
|
|
|
//
|
1999-01-07 19:25:53 +00:00
|
|
|
|
// $Id$
|
1999-05-12 02:04:38 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
#ifndef __PANEL_HXX
|
|
|
|
|
#define __PANEL_HXX
|
1998-06-27 16:47:53 +00:00
|
|
|
|
|
|
|
|
|
#ifndef __cplusplus
|
|
|
|
|
# error This library requires C++
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
1998-11-09 23:38:50 +00:00
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
# include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
1999-01-07 19:25:53 +00:00
|
|
|
|
#ifdef HAVE_WINDOWS_H
|
1998-11-09 23:38:50 +00:00
|
|
|
|
# include <windows.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <GL/glut.h>
|
2000-02-16 23:01:03 +00:00
|
|
|
|
#include <simgear/xgl/xgl.h>
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
#include <plib/ssg.h>
|
1998-11-09 23:38:50 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
class FGPanelInstrument;
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Instrument panel class.
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
class FGPanel
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FGPanel ();
|
1999-12-23 17:37:18 +00:00
|
|
|
|
virtual ~FGPanel ();
|
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
// Legacy interface from old panel.
|
|
|
|
|
static FGPanel * OurPanel;
|
|
|
|
|
virtual float get_height () const;
|
|
|
|
|
virtual void ReInit (int x, int y, int finx, int finy);
|
|
|
|
|
virtual void Update () const;
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
private:
|
|
|
|
|
int _x, _y, _w, _h;
|
|
|
|
|
int _panel_h;
|
|
|
|
|
|
|
|
|
|
ssgTexture * _bg;
|
|
|
|
|
|
|
|
|
|
const FGPanelInstrument * _airspeed;
|
|
|
|
|
const FGPanelInstrument * _horizon;
|
|
|
|
|
const FGPanelInstrument * _altimeter;
|
|
|
|
|
const FGPanelInstrument * _coordinator;
|
|
|
|
|
const FGPanelInstrument * _gyro;
|
|
|
|
|
const FGPanelInstrument * _vertical;
|
|
|
|
|
const FGPanelInstrument * _flaps;
|
|
|
|
|
const FGPanelInstrument * _rpm;
|
1999-03-08 21:56:08 +00:00
|
|
|
|
};
|
|
|
|
|
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Instrument base class.
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
class FGPanelInstrument
|
|
|
|
|
{
|
1999-12-23 17:37:18 +00:00
|
|
|
|
public:
|
2000-02-15 03:30:01 +00:00
|
|
|
|
FGPanelInstrument ();
|
|
|
|
|
FGPanelInstrument (int x, int y, int w, int h);
|
|
|
|
|
virtual ~FGPanelInstrument ();
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
virtual void draw () const = 0;
|
1999-03-08 21:56:08 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
virtual void setPosition(int x, int y);
|
|
|
|
|
virtual void setSize(int w, int h);
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
virtual int getXPos () const;
|
|
|
|
|
virtual int getYPos () const;
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
protected:
|
|
|
|
|
int _x, _y, _w, _h;
|
1999-03-08 21:56:08 +00:00
|
|
|
|
};
|
|
|
|
|
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// An instrument composed of layered textures.
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
class FGTexturedInstrument : public FGPanelInstrument
|
1999-12-23 17:37:18 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2000-02-15 03:30:01 +00:00
|
|
|
|
static const int MAX_LAYERS = 8;
|
|
|
|
|
FGTexturedInstrument (int x, int y, int w, int h);
|
|
|
|
|
virtual ~FGTexturedInstrument ();
|
|
|
|
|
|
|
|
|
|
virtual void addLayer (int layer, const char * textureName);
|
|
|
|
|
virtual void addLayer (int layer, ssgTexture * texture);
|
|
|
|
|
virtual void setLayerCenter (int layer, int x, int y);
|
|
|
|
|
virtual void setLayerRot (int layer, double rotation) const;
|
|
|
|
|
virtual void setLayerOffset (int layer, int xoffset, int yoffset) const;
|
|
|
|
|
virtual bool hasLayer (int layer) const;
|
|
|
|
|
|
|
|
|
|
virtual void draw () const;
|
1999-12-23 17:37:18 +00:00
|
|
|
|
protected:
|
2000-02-15 03:30:01 +00:00
|
|
|
|
bool _layers[MAX_LAYERS];
|
|
|
|
|
mutable int _xcenter[MAX_LAYERS];
|
|
|
|
|
mutable int _ycenter[MAX_LAYERS];
|
|
|
|
|
mutable double _rotation[MAX_LAYERS];
|
|
|
|
|
mutable int _xoffset[MAX_LAYERS];
|
|
|
|
|
mutable int _yoffset[MAX_LAYERS];
|
|
|
|
|
ssgTexture * _textures[MAX_LAYERS];
|
1999-03-08 21:56:08 +00:00
|
|
|
|
};
|
|
|
|
|
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Airspeed indicator.
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class FGAirspeedIndicator : public FGTexturedInstrument
|
1999-12-23 17:37:18 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FGAirspeedIndicator (int x, int y);
|
|
|
|
|
virtual ~FGAirspeedIndicator ();
|
2000-02-15 03:30:01 +00:00
|
|
|
|
virtual void draw () const;
|
1999-03-08 21:56:08 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Artificial Horizon.
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class FGHorizon : public FGTexturedInstrument
|
1999-12-23 17:37:18 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2000-02-15 03:30:01 +00:00
|
|
|
|
FGHorizon (int x, int y);
|
|
|
|
|
virtual ~FGHorizon ();
|
|
|
|
|
virtual void draw () const;
|
1999-12-23 17:37:18 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Altimeter.
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class FGAltimeter : public FGTexturedInstrument
|
1999-12-23 17:37:18 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FGAltimeter (int x, int y);
|
|
|
|
|
virtual ~FGAltimeter ();
|
2000-02-15 03:30:01 +00:00
|
|
|
|
virtual void draw () const;
|
|
|
|
|
};
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Turn Co-ordinator.
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class FGTurnCoordinator : public FGTexturedInstrument
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FGTurnCoordinator (int x, int y);
|
|
|
|
|
virtual ~FGTurnCoordinator ();
|
|
|
|
|
virtual void draw () const;
|
1999-12-23 17:37:18 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Gyro Compass.
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class FGGyroCompass : public FGTexturedInstrument
|
1999-12-23 17:37:18 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2000-02-15 03:30:01 +00:00
|
|
|
|
FGGyroCompass (int x, int y);
|
|
|
|
|
virtual ~FGGyroCompass ();
|
|
|
|
|
virtual void draw () const;
|
|
|
|
|
};
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Vertical velocity indicator.
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class FGVerticalVelocity : public FGTexturedInstrument
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FGVerticalVelocity (int x, int y);
|
|
|
|
|
virtual ~FGVerticalVelocity ();
|
|
|
|
|
virtual void draw () const;
|
1999-12-23 17:37:18 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// RPM gauge.
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class FGRPMGauge : public FGTexturedInstrument
|
1999-12-23 17:37:18 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2000-02-15 03:30:01 +00:00
|
|
|
|
FGRPMGauge (int x, int y);
|
|
|
|
|
virtual ~FGRPMGauge ();
|
|
|
|
|
virtual void draw () const;
|
|
|
|
|
};
|
1999-12-23 17:37:18 +00:00
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Flap position indicator.
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class FGFlapIndicator : public FGTexturedInstrument
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FGFlapIndicator (int x, int y);
|
|
|
|
|
virtual ~FGFlapIndicator ();
|
|
|
|
|
virtual void draw () const;
|
1999-12-23 17:37:18 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2000-02-15 03:30:01 +00:00
|
|
|
|
|
|
|
|
|
#endif // __PANEL_HXX
|
|
|
|
|
|
|
|
|
|
// end of panel.hxx
|
|
|
|
|
|
1998-11-09 23:38:50 +00:00
|
|
|
|
|