c4_RowRef row = vRunway->GetAt(index);
- r->id = (string) pID(row);
- r->rwy_no = (string) pRwy(row);
+ r->id = (const char *) pID(row);
+ r->rwy_no = (const char *) pRwy(row);
r->lon = (double) pLon(row);
r->lat = (double) pLat(row);
r->heading = (double) pHdg(row);
r->length = (double) pLen(row);
r->width = (double) pWid(row);
- r->surface_flags = (string) pSurf(row);
- r->end1_flags = (string) pEnd1(row);
- r->end2_flags = (string) pEnd2(row);
+ r->surface_flags = (const char *) pSurf(row);
+ r->end1_flags = (const char *) pEnd1(row);
+ r->end2_flags = (const char *) pEnd2(row);
return true;
}
c4_RowRef row = vRunway->GetAt(index);
- r->id = (string) pID(row);
- r->rwy_no = (string) pRwy(row);
+ r->id = (const char *) pID(row);
+ r->rwy_no = (const char *) pRwy(row);
r->lon = (double) pLon(row);
r->lat = (double) pLat(row);
r->heading = (double) pHdg(row);
r->length = (double) pLen(row);
r->width = (double) pWid(row);
- r->surface_flags = (string) pSurf(row);
- r->end1_flags = (string) pEnd1(row);
- r->end2_flags = (string) pEnd2(row);
+ r->surface_flags = (const char *) pSurf(row);
+ r->end1_flags = (const char *) pEnd1(row);
+ r->end2_flags = (const char *) pEnd2(row);
return true;
}
#ifdef __MWERKS__
- in >> skipws;
+ in >> ::skipws;
char c = 0;
while ( in.get(c) && c != '\0' ) {
if ( c == 'A' ) {
} else {
in >> skipeol;
}
- in >> skipws;
+ in >> ::skipws;
}
#else
x = (int)(((float)x / current_view.get_winWidth()) * _w);
y = (int)(_h - (((float)y / current_view.get_winHeight()) * _h));
- for (int i = 0; i < _instruments.size(); i++) {
+ for (int i = 0; i < (int)_instruments.size(); i++) {
FGPanelInstrument *inst = _instruments[i];
int ix = inst->getXPos();
int iy = inst->getYPos();
FGAdjustAction::FGAdjustAction (int button, int x, int y, int w, int h,
SGValue * value, float increment,
- float min, float max, bool wrap=false)
+ float min, float max, bool wrap)
: FGPanelAction(button, x, y, w, h),
_value(value), _increment(increment), _min(min), _max(max), _wrap(wrap)
{
void
FGLayeredInstrument::draw ()
{
- for (int i = 0; i < _layers.size(); i++) {
+ for (int i = 0; i < (int)_layers.size(); i++) {
glPushMatrix();
glTranslatef(0.0, 0.0, (i / 100.0) + 0.1);
_layers[i]->draw();
int
FGLayeredInstrument::addLayer (CroppedTexture &texture,
- int w = -1, int h = -1)
+ int w, int h)
{
return addLayer(new FGTexturedLayer(texture, w, h));
}
////////////////////////////////////////////////////////////////////////
-FGTexturedLayer::FGTexturedLayer (CroppedTexture &texture, int w, int h)
+FGTexturedLayer::FGTexturedLayer (const CroppedTexture &texture, int w, int h)
: FGInstrumentLayer(w, h)
{
setTexture(texture);
}
+\f
+////////////////////////////////////////////////////////////////////////
+// Implementation of FGWindowLayer.
+////////////////////////////////////////////////////////////////////////
+
+FGWindowLayer::FGWindowLayer (int w, int h)
+ : FGTexturedLayer (w, h)
+{
+}
+
+FGWindowLayer::FGWindowLayer (const CroppedTexture &texture, int w, int h)
+ : FGTexturedLayer(texture, w, h)
+{
+}
+
+FGWindowLayer::~FGWindowLayer ()
+{
+}
+
+void
+FGWindowLayer::draw ()
+{
+ // doesn't do anything yet
+ FGTexturedLayer::draw();
+}
+
+
\f
////////////////////////////////////////////////////////////////////////
// Implementation of FGTextLayer.
FGTextLayer::FGTextLayer (int w, int h, Chunk * chunk1, Chunk * chunk2,
Chunk * chunk3)
- : FGInstrumentLayer(w, h)
+ : FGInstrumentLayer(w, h), _pointSize(14.0)
{
_color[0] = _color[1] = _color[2] = 0.0;
_color[3] = 1.0;
glColor4fv(_color);
transform();
_renderer.setFont(guiFntHandle);
- _renderer.setPointSize(14);
+ _renderer.setPointSize(_pointSize);
_renderer.begin();
_renderer.start3f(0, 0, 0);
chunk_list::const_iterator it = _chunks.begin();
chunk_list::const_iterator last = _chunks.end();
for ( ; it != last; it++) {
- _renderer.puts((*it)->getValue());
+ _renderer.puts((char *)((*it)->getValue()));
}
_renderer.end();
}
void
-FGTextLayer::setPointSize (const float size)
+FGTextLayer::setPointSize (float size)
{
- _renderer.setPointSize(size);
+ _pointSize = size;
}
void
// Implementation of FGTextLayer::Chunk.
////////////////////////////////////////////////////////////////////////
-FGTextLayer::Chunk::Chunk (char * text, char * fmt = "%s")
+FGTextLayer::Chunk::Chunk (const string &text, const string &fmt)
: _type(FGTextLayer::TEXT), _fmt(fmt)
{
- _value._text = text;
+ _text = text;
+ if (_fmt == "")
+ _fmt = "%s";
}
FGTextLayer::Chunk::Chunk (ChunkType type, const SGValue * value,
- char * fmt = 0, float mult = 1.0)
+ const string &fmt, float mult)
: _type(type), _fmt(fmt), _mult(mult)
{
- if (_fmt == 0) {
+ if (_fmt == "") {
if (type == TEXT_VALUE)
_fmt = "%s";
else
_fmt = "%.2f";
}
- _value._value = value;
+ _value = value;
}
-char *
+const char *
FGTextLayer::Chunk::getValue () const
{
switch (_type) {
case TEXT:
- sprintf(_buf, _fmt, _value._text);
+ sprintf(_buf, _fmt.c_str(), _text.c_str());
return _buf;
case TEXT_VALUE:
- sprintf(_buf, _fmt, _value._value->getStringValue().c_str());
+ sprintf(_buf, _fmt.c_str(), _value->getStringValue().c_str());
break;
case DOUBLE_VALUE:
- sprintf(_buf, _fmt, _value._value->getFloatValue() * _mult);
+ sprintf(_buf, _fmt.c_str(), _value->getFloatValue() * _mult);
break;
}
return _buf;
-// panel.hxx - default, 2D single-engine prop instrument panel
+// panel.hxx - generic support classes for a 2D panel.
//
// Written by David Megginson, started January 2000.
//
public:
static ssgTexture * createTexture(const string &relativePath);
private:
- static map<string,ssgTexture *>_textureMap;
+ static map<string,ssgTexture *> _textureMap;
};
////////////////////////////////////////////////////////////////////////
// Cropped texture (should migrate out into FGFS).
//
-// This class defines a rectangular cropped area of a texture.
+// This structure wraps an SSG texture with cropping information.
////////////////////////////////////////////////////////////////////////
struct CroppedTexture
FGPanelAction (int button, int x, int y, int w, int h);
virtual ~FGPanelAction ();
+ // Getters.
virtual int getButton () const { return _button; }
virtual int getX () const { return _x; }
virtual int getY () const { return _y; }
virtual int getWidth () const { return _w; }
virtual int getHeight () const { return _h; }
+ // Setters.
virtual void setButton (int button) { _button = button; }
virtual void setX (int x) { _x = x; }
virtual void setY (int y) { _y = y; }
virtual void setWidth (int w) { _w = w; }
virtual void setHeight (int h) { _h = h; }
+ // Check whether we're in the area.
virtual bool inArea (int button, int x, int y)
{
return (button == _button &&
y < _y + _h);
}
+ // Perform the action.
virtual void doAction () = 0;
private:
{
public:
FGTexturedLayer (int w = -1, int h = -1) : FGInstrumentLayer(w, h) {}
- FGTexturedLayer (CroppedTexture &texture, int w = -1, int h = -1);
+ FGTexturedLayer (const CroppedTexture &texture, int w = -1, int h = -1);
virtual ~FGTexturedLayer ();
virtual void draw ();
- virtual void setTexture (CroppedTexture &texture) { _texture = texture; }
+ virtual void setTexture (const CroppedTexture &texture) {
+ _texture = texture;
+ }
virtual CroppedTexture &getTexture () { return _texture; }
+ virtual const CroppedTexture &getTexture () const { return _texture; }
private:
mutable CroppedTexture _texture;
};
+\f
+////////////////////////////////////////////////////////////////////////
+// A moving window on a texture.
+//
+// This layer automatically recrops a cropped texture based on
+// property values, creating a moving window over the texture.
+////////////////////////////////////////////////////////////////////////
+
+class FGWindowLayer : public FGTexturedLayer
+{
+public:
+ FGWindowLayer (int w = -1, int h = -1);
+ FGWindowLayer (const CroppedTexture &texture, int w = -1, int h = -1);
+ virtual ~FGWindowLayer ();
+
+ virtual void draw ();
+
+ virtual const SGValue * getXValue () const { return _xValue; }
+ virtual void setXValue (const SGValue * value) { _xValue = value; }
+ virtual const SGValue * getYValue () const { return _yValue; }
+ virtual void setYValue (const SGValue * value) { _yValue = value; }
+
+private:
+ const SGValue * _xValue;
+ const SGValue * _yValue;
+};
+
+
\f
////////////////////////////////////////////////////////////////////////
// A text layer of an instrument.
class Chunk {
public:
- Chunk (char * text, char * fmt = "%s");
+ Chunk (const string &text, const string &fmt = "%s");
Chunk (ChunkType type, const SGValue * value,
- char * fmt = 0, float mult = 1.0);
+ const string &fmt = "", float mult = 1.0);
- char * getValue () const;
+ const char * getValue () const;
private:
ChunkType _type;
- union {
- char * _text;
- const SGValue * _value;
- } _value;
- char * _fmt;
+ string _text;
+ const SGValue * _value;
+ string _fmt;
float _mult;
mutable char _buf[1024];
};
typedef vector<Chunk *> chunk_list;
chunk_list _chunks;
float _color[4];
+
+ float _pointSize;
// FIXME: need only one globally
mutable fntRenderer _renderer;
};
current_properties.tieDouble("/steam/gyro-compass-error",
FGSteam::get_DG_err,
FGSteam::set_DG_err);
+ current_properties.tieDouble("/steam/mag-compass",
+ FGSteam::get_MH_deg);
}
_UpdatesPending += timesteps;
}
extern COCKPIT cockpit_;
+ SCALAR CLadot;
+ SCALAR CLq;
+ SCALAR CLde;
+ SCALAR CLob;
+
+
+ SCALAR Cdob;
+ SCALAR Cda; /*Not used*/
+ SCALAR Cdde;
+
+ SCALAR Cma;
+ SCALAR Cmadot;
+ SCALAR Cmq;
+ SCALAR Cmob;
+ SCALAR Cmde;
+
+ SCALAR Clbeta;
+ SCALAR Clp;
+ SCALAR Clr;
+ SCALAR Clda;
+ SCALAR Cldr;
+
+ SCALAR Cnbeta;
+ SCALAR Cnp;
+ SCALAR Cnr;
+ SCALAR Cnda;
+ SCALAR Cndr;
+
+ SCALAR Cybeta;
+ SCALAR Cyp;
+ SCALAR Cyr;
+ SCALAR Cyda;
+ SCALAR Cydr;
+
+ /*nondimensionalization quantities*/
+ /*units here are ft and lbs */
+ SCALAR cbar; /*mean aero chord ft*/
+ SCALAR b; /*wing span ft */
+ SCALAR Sw; /*wing planform surface area ft^2*/
+ SCALAR rPiARe; /*reciprocal of Pi*AR*e*/
+ SCALAR lbare; /*elevator moment arm MAC*/
+
+ SCALAR Weight; /*lbs*/
+ SCALAR MaxTakeoffWeight,EmptyWeight;
+ SCALAR Cg; /*%MAC*/
+ SCALAR Zcg; /*%MAC*/
+
+
+ SCALAR CLwbh,CL,cm,cd,cn,cy,croll,cbar_2V,b_2V,qS,qScbar,qSb;
+ SCALAR CLo,Cdo,Cmo;
+
+ SCALAR F_X_wind,F_Y_wind,F_Z_wind;
+
+ SCALAR long_trim;
+
+
+ SCALAR elevator, aileron, rudder;
+
+
+ SCALAR Flap_Position;
+
+ int Flaps_In_Transit;
+
static SCALAR interp(SCALAR *y_table, SCALAR *x_table, int Ntable, SCALAR x)
{
SCALAR slope;
/*global declarations of aero model parameters*/
- SCALAR CLadot;
- SCALAR CLq;
- SCALAR CLde;
- SCALAR CLob;
+ extern SCALAR CLadot;
+ extern SCALAR CLq;
+ extern SCALAR CLde;
+ extern SCALAR CLob;
- SCALAR Cdob;
- SCALAR Cda; /*Not used*/
- SCALAR Cdde;
+ extern SCALAR Cdob;
+ extern SCALAR Cda; /*Not used*/
+ extern SCALAR Cdde;
- SCALAR Cma;
- SCALAR Cmadot;
- SCALAR Cmq;
- SCALAR Cmob;
- SCALAR Cmde;
+ extern SCALAR Cma;
+ extern SCALAR Cmadot;
+ extern SCALAR Cmq;
+ extern SCALAR Cmob;
+ extern SCALAR Cmde;
- SCALAR Clbeta;
- SCALAR Clp;
- SCALAR Clr;
- SCALAR Clda;
- SCALAR Cldr;
+ extern SCALAR Clbeta;
+ extern SCALAR Clp;
+ extern SCALAR Clr;
+ extern SCALAR Clda;
+ extern SCALAR Cldr;
- SCALAR Cnbeta;
- SCALAR Cnp;
- SCALAR Cnr;
- SCALAR Cnda;
- SCALAR Cndr;
+ extern SCALAR Cnbeta;
+ extern SCALAR Cnp;
+ extern SCALAR Cnr;
+ extern SCALAR Cnda;
+ extern SCALAR Cndr;
- SCALAR Cybeta;
- SCALAR Cyp;
- SCALAR Cyr;
- SCALAR Cyda;
- SCALAR Cydr;
+ extern SCALAR Cybeta;
+ extern SCALAR Cyp;
+ extern SCALAR Cyr;
+ extern SCALAR Cyda;
+ extern SCALAR Cydr;
/*nondimensionalization quantities*/
/*units here are ft and lbs */
- SCALAR cbar; /*mean aero chord ft*/
- SCALAR b; /*wing span ft */
- SCALAR Sw; /*wing planform surface area ft^2*/
- SCALAR rPiARe; /*reciprocal of Pi*AR*e*/
- SCALAR lbare; /*elevator moment arm MAC*/
+ extern SCALAR cbar; /*mean aero chord ft*/
+ extern SCALAR b; /*wing span ft */
+ extern SCALAR Sw; /*wing planform surface area ft^2*/
+ extern SCALAR rPiARe; /*reciprocal of Pi*AR*e*/
+ extern SCALAR lbare; /*elevator moment arm MAC*/
- SCALAR Weight; /*lbs*/
- SCALAR MaxTakeoffWeight,EmptyWeight;
- SCALAR Cg; /*%MAC*/
- SCALAR Zcg; /*%MAC*/
+ extern SCALAR Weight; /*lbs*/
+ extern SCALAR MaxTakeoffWeight,EmptyWeight;
+ extern SCALAR Cg; /*%MAC*/
+ extern SCALAR Zcg; /*%MAC*/
- SCALAR CLwbh,CL,cm,cd,cn,cy,croll,cbar_2V,b_2V,qS,qScbar,qSb;
- SCALAR CLo,Cdo,Cmo;
+ extern SCALAR CLwbh,CL,cm,cd,cn,cy,croll,cbar_2V,b_2V,qS,qScbar,qSb;
+ extern SCALAR CLo,Cdo,Cmo;
- SCALAR F_X_wind,F_Y_wind,F_Z_wind;
+ extern SCALAR F_X_wind,F_Y_wind,F_Z_wind;
- SCALAR long_trim;
+ extern SCALAR long_trim;
- SCALAR elevator, aileron, rudder;
+ extern SCALAR elevator, aileron, rudder;
- SCALAR Flap_Position;
+ extern SCALAR Flap_Position;
- int Flaps_In_Transit;
+ extern int Flaps_In_Transit;
$Header$
$Log$
+Revision 1.16 2000/09/13 19:51:09 curt
+MacOS changes by Darrell Walisser.
+
Revision 1.15 2000/06/12 18:52:37 curt
Added differential braking (Alex and David).
percent_brake[1] = Brake_pct[0];
percent_brake[2] = Brake_pct[1];
- caster_angle_rad[0] = 0.52*Rudder_pedal;
+ caster_angle_rad[0] = 0.03*Rudder_pedal;
for (i=0;i<num_wheels;i++) /* Loop for each wheel */
seen_joystick = true;
// Set up range arrays
- float minRange[naxes];
- float maxRange[naxes];
- float center[naxes];
+ float *minRange = new float[naxes];
+ float *maxRange = new float[naxes];
+ float *center = new float[naxes];
// Initialize with default values
js->getMinRange(minRange);
js->setMinRange(minRange);
js->setMaxRange(maxRange);
js->setCenter(center);
+
+ //-dw- clean up
+ delete minRange;
+ delete maxRange;
+ delete center;
}
if (seen_joystick)
for (int i = 0; i < MAX_JOYSTICKS; i++) {
jsJoystick * js = joysticks[i].js;
- float axis_values[joysticks[i].naxes];
+ float *axis_values = new float[joysticks[i].naxes];
if (js->notWorking()) {
continue;
}
FG_LOG(FG_INPUT, FG_ALERT, "Failed to set value for "
<< jsNames[i] << ' ' << buttonNames[j]);
}
+
+ // -dw- cleanup
+ delete axis_values;
+
}
return true;
#include <Cockpit/hud.hxx>
#include <Cockpit/panel.hxx>
#include <Cockpit/panel_io.hxx>
+#include <Cockpit/sp_panel.hxx>
#include <GUI/gui.h>
#include <Scenery/tilemgr.hxx>
#include <Objects/matlib.hxx>
current_panel = new_panel;
return;
}
+ case GLUT_KEY_F4: {
+ delete current_panel;
+ current_panel = fgCreateSmallSinglePropPanel(0, 0, 1024, 768);
+ FG_LOG(FG_INPUT, FG_INFO, "Reverted to built-in panel");
+ return;
+ }
case GLUT_KEY_END: // numeric keypad 1
v->set_goal_view_offset( FG_PI * 0.75 );
return;
#ifdef __MWERKS__
char c = 0;
- while ( in.get(c) && c != '\0' && n.get_ilstype() != '[' ) {
+ while ( in.get(c) && c != '\0' && ils.get_ilstype() != '[' ) {
in.putback(c);
in >> ils;
- if ( ils.get_type() != '[' ) {
+ if ( ils.get_ilstype() != '[' ) {
ilslist[ils.get_locfreq()].push_back(ils);
}
in >> skipcomment;