1
0
Fork 0

Updates from David Megginson:

I've done some substantial reengineering of the 2D panel: except for the
radios, the whole panel is built from a large table now.  I'd be
grateful if you could add these changes to the main distribution.

Since I always like to provide some eye-candy with my updates, I've
fixed the ADF gauge to be more usable by slimming the needle and adding
markings every 45 deg (you'll need to use the attached textures).
This commit is contained in:
curt 2000-06-14 20:59:51 +00:00
parent dcdd61c590
commit 016cd935ef
4 changed files with 652 additions and 769 deletions

View file

@ -243,20 +243,23 @@ float get_fov( void )
float get_vfc_ratio( void ) float get_vfc_ratio( void )
{ {
float vfc = current_view.get_vfc_ratio(); // float vfc = current_view.get_vfc_ratio();
return (vfc); // return (vfc);
return 0.0;
} }
float get_vfc_tris_drawn ( void ) float get_vfc_tris_drawn ( void )
{ {
float rendered = current_view.get_tris_rendered(); // float rendered = current_view.get_tris_rendered();
return (rendered); // return (rendered);
return 0.0;
} }
float get_vfc_tris_culled ( void ) float get_vfc_tris_culled ( void )
{ {
float culled = current_view.get_tris_culled(); // float culled = current_view.get_tris_culled();
return (culled); // return (culled);
return 0.0;
} }
float get_climb_rate( void ) float get_climb_rate( void )

View file

@ -190,6 +190,7 @@ bool
FGPanel::doMouseAction (int button, int updown, int x, int y) FGPanel::doMouseAction (int button, int updown, int x, int y)
{ {
// Note a released button and return // Note a released button and return
// cerr << "Doing mouse action\n";
if (updown == 1) { if (updown == 1) {
_mouseDown = false; _mouseDown = false;
_mouseInstrument = 0; _mouseInstrument = 0;
@ -431,23 +432,21 @@ int
FGLayeredInstrument::addLayer (FGInstrumentLayer *layer) FGLayeredInstrument::addLayer (FGInstrumentLayer *layer)
{ {
int n = _layers.size(); int n = _layers.size();
if (layer->getWidth() == -1) {
layer->setWidth(getWidth());
}
if (layer->getHeight() == -1) {
layer->setHeight(getHeight());
}
_layers.push_back(layer); _layers.push_back(layer);
return n; return n;
} }
int int
FGLayeredInstrument::addLayer (ssgTexture * texture, FGLayeredInstrument::addLayer (CroppedTexture &texture,
int w = -1, int h = -1, int w = -1, int h = -1)
float texX1 = 0.0, float texY1 = 0.0,
float texX2 = 1.0, float texY2 = 1.0)
{ {
if (w == -1) return addLayer(new FGTexturedLayer(texture, w, h));
w = _w;
if (h == -1)
h = _h;
FGTexturedLayer * layer = new FGTexturedLayer(texture, w, h);
layer->setTextureCoords(texX1, texY1, texX2, texY2);
return addLayer(layer);
} }
void void
@ -541,13 +540,21 @@ FGInstrumentLayer::addTransformation (transform_type type,
// Implementation of FGTexturedLayer. // Implementation of FGTexturedLayer.
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
FGTexturedLayer::FGTexturedLayer (ssgTexture * texture, int w, int h, // FGTexturedLayer::FGTexturedLayer (ssgTexture * texture, int w, int h,
float texX1 = 0.0, float texY1 = 0.0, // float texX1 = 0.0, float texY1 = 0.0,
float texX2 = 1.0, float texY2 = 1.0) // float texX2 = 1.0, float texY2 = 1.0)
// : FGInstrumentLayer(w, h),
// _texX1(texX1), _texY1(texY1), _texX2(texX2), _texY2(texY2)
// {
// setTexture(texture);
// }
FGTexturedLayer::FGTexturedLayer (CroppedTexture &texture, int w, int h)
: FGInstrumentLayer(w, h), : FGInstrumentLayer(w, h),
_texX1(texX1), _texY1(texY1), _texX2(texX2), _texY2(texY2) _texX1(texture.minX), _texY1(texture.minY),
_texX2(texture.maxX), _texY2(texture.maxY)
{ {
setTexture(texture); setTexture(texture.texture);
} }
FGTexturedLayer::~FGTexturedLayer () FGTexturedLayer::~FGTexturedLayer ()
@ -581,11 +588,18 @@ FGTexturedLayer::draw () const
// Implementation of FGTextLayer. // Implementation of FGTextLayer.
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
FGTextLayer::FGTextLayer (int w, int h) FGTextLayer::FGTextLayer (int w, int h, Chunk * chunk1, Chunk * chunk2,
Chunk * chunk3)
: FGInstrumentLayer(w, h) : FGInstrumentLayer(w, h)
{ {
_color[0] = _color[1] = _color[2] = 0.0; _color[0] = _color[1] = _color[2] = 0.0;
_color[3] = 1.0; _color[3] = 1.0;
if (chunk1)
addChunk(chunk1);
if (chunk2)
addChunk(chunk2);
if (chunk3)
addChunk(chunk3);
} }
FGTextLayer::~FGTextLayer () FGTextLayer::~FGTextLayer ()

View file

@ -62,6 +62,28 @@ private:
static map<const char *,ssgTexture *>_textureMap; static map<const char *,ssgTexture *>_textureMap;
}; };
////////////////////////////////////////////////////////////////////////
// Cropped texture (should migrate out into FGFS).
//
// This class defines a rectangular cropped area of a texture.
////////////////////////////////////////////////////////////////////////
struct CroppedTexture
{
CroppedTexture () {}
CroppedTexture (const char * path,
float _minX = 0.0, float _minY = 0.0,
float _maxX = 1.0, float _maxY = 1.0)
: texture(FGTextureManager::createTexture(path)),
minX(_minX), minY(_minY), maxX(_maxX), maxY(_maxY) {}
ssgTexture * texture;
float minX, minY, maxX, maxY;
};
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Instrument panel class. // Instrument panel class.
@ -284,14 +306,17 @@ public:
typedef double (*transform_func)(); typedef double (*transform_func)();
FGInstrumentLayer (int w = -1, int h = -1);
FGInstrumentLayer ();
FGInstrumentLayer (int w, int h);
virtual ~FGInstrumentLayer (); virtual ~FGInstrumentLayer ();
virtual void draw () const = 0; virtual void draw () const = 0;
virtual void transform () const; virtual void transform () const;
virtual int getWidth () const { return _w; }
virtual int getHeight () const { return _h; }
virtual void setWidth (int w) { _w = w; }
virtual void setHeight (int h) { _h = h; }
virtual void addTransformation (transform_type type, transform_func func, virtual void addTransformation (transform_type type, transform_func func,
float min, float max, float min, float max,
float factor = 1.0, float offset = 0.0); float factor = 1.0, float offset = 0.0);
@ -341,10 +366,8 @@ public:
// Transfer pointer ownership!! // Transfer pointer ownership!!
virtual int addLayer (FGInstrumentLayer *layer); virtual int addLayer (FGInstrumentLayer *layer);
virtual int addLayer (ssgTexture * texture, virtual int addLayer (CroppedTexture &texture,
int w = -1, int h = -1, int w = -1, int h = -1);
float texX1 = 0.0, float texY1 = 0.0,
float texX2 = 1.0, float texY2 = 1.0);
virtual void addTransformation (FGInstrumentLayer::transform_type type, virtual void addTransformation (FGInstrumentLayer::transform_type type,
FGInstrumentLayer::transform_func func, FGInstrumentLayer::transform_func func,
float min, float max, float min, float max,
@ -369,14 +392,17 @@ protected:
class FGTexturedLayer : public FGInstrumentLayer class FGTexturedLayer : public FGInstrumentLayer
{ {
public: public:
FGTexturedLayer (ssgTexture * texture, int w, int h, // FGTexturedLayer (ssgTexture * texture, int w, int h,
float texX1 = 0.0, float texY1 = 0.0, // float texX1 = 0.0, float texY1 = 0.0,
float texX2 = 1.0, float texY2 = 1.0); // float texX2 = 1.0, float texY2 = 1.0);
FGTexturedLayer (int w = -1, int h = -1) : FGInstrumentLayer(w, h) {}
FGTexturedLayer (CroppedTexture &texture, int w = -1, int h = -1);
virtual ~FGTexturedLayer (); virtual ~FGTexturedLayer ();
virtual void draw () const; virtual void draw () const;
virtual void setTexture (ssgTexture * texture) { _texture = texture; } virtual void setTexture (ssgTexture * texture) { _texture = texture; }
virtual ssgTexture * getTexture () { return _texture; }
virtual void setTextureCoords (float x1, float y1, float x2, float y2) { virtual void setTextureCoords (float x1, float y1, float x2, float y2) {
_texX1 = x1; _texY1 = y1; _texX2 = x2; _texY2 = y2; _texX1 = x1; _texY1 = y1; _texX2 = x2; _texY2 = y2;
} }
@ -434,7 +460,8 @@ public:
mutable char _buf[1024]; mutable char _buf[1024];
}; };
FGTextLayer (int w, int h); FGTextLayer (int w = -1, int h = -1, Chunk * chunk1 = 0, Chunk * chunk2 = 0,
Chunk * chunk3 = 0);
virtual ~FGTextLayer (); virtual ~FGTextLayer ();
virtual void draw () const; virtual void draw () const;

File diff suppressed because it is too large Load diff