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:
parent
dcdd61c590
commit
016cd935ef
4 changed files with 652 additions and 769 deletions
|
@ -243,20 +243,23 @@ float get_fov( void )
|
|||
|
||||
float get_vfc_ratio( void )
|
||||
{
|
||||
float vfc = current_view.get_vfc_ratio();
|
||||
return (vfc);
|
||||
// float vfc = current_view.get_vfc_ratio();
|
||||
// return (vfc);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
float get_vfc_tris_drawn ( void )
|
||||
{
|
||||
float rendered = current_view.get_tris_rendered();
|
||||
return (rendered);
|
||||
// float rendered = current_view.get_tris_rendered();
|
||||
// return (rendered);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
float get_vfc_tris_culled ( void )
|
||||
{
|
||||
float culled = current_view.get_tris_culled();
|
||||
return (culled);
|
||||
// float culled = current_view.get_tris_culled();
|
||||
// return (culled);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
float get_climb_rate( void )
|
||||
|
|
|
@ -190,6 +190,7 @@ bool
|
|||
FGPanel::doMouseAction (int button, int updown, int x, int y)
|
||||
{
|
||||
// Note a released button and return
|
||||
// cerr << "Doing mouse action\n";
|
||||
if (updown == 1) {
|
||||
_mouseDown = false;
|
||||
_mouseInstrument = 0;
|
||||
|
@ -431,23 +432,21 @@ int
|
|||
FGLayeredInstrument::addLayer (FGInstrumentLayer *layer)
|
||||
{
|
||||
int n = _layers.size();
|
||||
if (layer->getWidth() == -1) {
|
||||
layer->setWidth(getWidth());
|
||||
}
|
||||
if (layer->getHeight() == -1) {
|
||||
layer->setHeight(getHeight());
|
||||
}
|
||||
_layers.push_back(layer);
|
||||
return n;
|
||||
}
|
||||
|
||||
int
|
||||
FGLayeredInstrument::addLayer (ssgTexture * texture,
|
||||
int w = -1, int h = -1,
|
||||
float texX1 = 0.0, float texY1 = 0.0,
|
||||
float texX2 = 1.0, float texY2 = 1.0)
|
||||
FGLayeredInstrument::addLayer (CroppedTexture &texture,
|
||||
int w = -1, int h = -1)
|
||||
{
|
||||
if (w == -1)
|
||||
w = _w;
|
||||
if (h == -1)
|
||||
h = _h;
|
||||
FGTexturedLayer * layer = new FGTexturedLayer(texture, w, h);
|
||||
layer->setTextureCoords(texX1, texY1, texX2, texY2);
|
||||
return addLayer(layer);
|
||||
return addLayer(new FGTexturedLayer(texture, w, h));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -541,13 +540,21 @@ FGInstrumentLayer::addTransformation (transform_type type,
|
|||
// Implementation of FGTexturedLayer.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FGTexturedLayer::FGTexturedLayer (ssgTexture * texture, int w, int h,
|
||||
float texX1 = 0.0, float texY1 = 0.0,
|
||||
float texX2 = 1.0, float texY2 = 1.0)
|
||||
// FGTexturedLayer::FGTexturedLayer (ssgTexture * texture, int w, int h,
|
||||
// float texX1 = 0.0, float texY1 = 0.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),
|
||||
_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 ()
|
||||
|
@ -581,11 +588,18 @@ FGTexturedLayer::draw () const
|
|||
// Implementation of FGTextLayer.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FGTextLayer::FGTextLayer (int w, int h)
|
||||
FGTextLayer::FGTextLayer (int w, int h, Chunk * chunk1, Chunk * chunk2,
|
||||
Chunk * chunk3)
|
||||
: FGInstrumentLayer(w, h)
|
||||
{
|
||||
_color[0] = _color[1] = _color[2] = 0.0;
|
||||
_color[3] = 1.0;
|
||||
if (chunk1)
|
||||
addChunk(chunk1);
|
||||
if (chunk2)
|
||||
addChunk(chunk2);
|
||||
if (chunk3)
|
||||
addChunk(chunk3);
|
||||
}
|
||||
|
||||
FGTextLayer::~FGTextLayer ()
|
||||
|
|
|
@ -62,6 +62,28 @@ private:
|
|||
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.
|
||||
|
@ -284,14 +306,17 @@ public:
|
|||
|
||||
typedef double (*transform_func)();
|
||||
|
||||
|
||||
FGInstrumentLayer ();
|
||||
FGInstrumentLayer (int w, int h);
|
||||
FGInstrumentLayer (int w = -1, int h = -1);
|
||||
virtual ~FGInstrumentLayer ();
|
||||
|
||||
virtual void draw () const = 0;
|
||||
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,
|
||||
float min, float max,
|
||||
float factor = 1.0, float offset = 0.0);
|
||||
|
@ -341,10 +366,8 @@ public:
|
|||
|
||||
// Transfer pointer ownership!!
|
||||
virtual int addLayer (FGInstrumentLayer *layer);
|
||||
virtual int addLayer (ssgTexture * texture,
|
||||
int w = -1, int h = -1,
|
||||
float texX1 = 0.0, float texY1 = 0.0,
|
||||
float texX2 = 1.0, float texY2 = 1.0);
|
||||
virtual int addLayer (CroppedTexture &texture,
|
||||
int w = -1, int h = -1);
|
||||
virtual void addTransformation (FGInstrumentLayer::transform_type type,
|
||||
FGInstrumentLayer::transform_func func,
|
||||
float min, float max,
|
||||
|
@ -369,14 +392,17 @@ protected:
|
|||
class FGTexturedLayer : public FGInstrumentLayer
|
||||
{
|
||||
public:
|
||||
FGTexturedLayer (ssgTexture * texture, int w, int h,
|
||||
float texX1 = 0.0, float texY1 = 0.0,
|
||||
float texX2 = 1.0, float texY2 = 1.0);
|
||||
// FGTexturedLayer (ssgTexture * texture, int w, int h,
|
||||
// float texX1 = 0.0, float texY1 = 0.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 void draw () const;
|
||||
|
||||
virtual void setTexture (ssgTexture * texture) { _texture = texture; }
|
||||
virtual ssgTexture * getTexture () { return _texture; }
|
||||
virtual void setTextureCoords (float x1, float y1, float x2, float y2) {
|
||||
_texX1 = x1; _texY1 = y1; _texX2 = x2; _texY2 = y2;
|
||||
}
|
||||
|
@ -434,7 +460,8 @@ public:
|
|||
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 void draw () const;
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue