: _mouseDown(false),
_mouseInstrument(0),
_width(WIN_W), _height(int(WIN_H * 0.5768 + 1)),
- _x_offset(0), _y_offset(0), _view_height(int(WIN_H * 0.4232)),
- _jitter(0.0),
+ _view_height(int(WIN_H * 0.4232)),
_xsize_node(fgGetNode("/sim/startup/xsize", true)),
- _ysize_node(fgGetNode("/sim/startup/ysize", true))
+ _ysize_node(fgGetNode("/sim/startup/ysize", true)),
+ _visibility(fgGetNode("/sim/panel/visibility", true)),
+ _x_offset(fgGetNode("/sim/panel/x-offset", true)),
+ _y_offset(fgGetNode("/sim/panel/y-offset", true)),
+ _jitter(fgGetNode("/sim/panel/jitter", true)),
+ _flipx(fgGetNode("/sim/panel/flip-x", true))
{
- setVisibility(fgPanelVisible());
}
void
FGPanel::update (double dt)
{
- // TODO: cache the nodes
- _visibility = fgGetBool("/sim/panel/visibility");
- _x_offset = fgGetInt("/sim/panel/x-offset");
- _y_offset = fgGetInt("/sim/panel/y-offset");
- _jitter = fgGetFloat("/sim/panel/jitter");
- _flipx = fgGetBool("/sim/panel/flip-x");
-
// Do nothing if the panel isn't visible.
if ( !fgPanelVisible() ) {
return;
// The factors and bounds are just
// initial guesses; using sqrt smooths
// out the spikes.
- double x_offset = _x_offset;
- double y_offset = _y_offset;
+ double x_offset = _x_offset->getIntValue();
+ double y_offset = _y_offset->getIntValue();
#if 0
- if (_jitter != 0.0) {
+ if (_jitter->getFloatValue() != 0.0) {
double a_x_pilot = current_aircraft.fdm_state->get_A_X_pilot();
double a_y_pilot = current_aircraft.fdm_state->get_A_Y_pilot();
double a_z_pilot = current_aircraft.fdm_state->get_A_Z_pilot();
double a_zx_pilot = a_z_pilot - a_x_pilot;
- int x_adjust = int(sqrt(fabs(a_y_pilot) * _jitter)) *
+ int x_adjust = int(sqrt(fabs(a_y_pilot) * _jitter->getFloatValue())) *
(a_y_pilot < 0 ? -1 : 1);
- int y_adjust = int(sqrt(fabs(a_zx_pilot) * _jitter)) *
+ int y_adjust = int(sqrt(fabs(a_zx_pilot) * _jitter->getFloatValue())) *
(a_zx_pilot < 0 ? -1 : 1);
// adjustments in screen coordinates
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
- if ( _flipx ) {
+ if ( _flipx->getBoolValue() ) {
gluOrtho2D(winx + winw, winx, winy + winh, winy); /* up side down */
} else {
gluOrtho2D(winx, winx + winw, winy, winy + winh); /* right side up */
void
FGPanel::setVisibility (bool visibility)
{
- _visibility = visibility;
+ _visibility->setBoolValue( visibility );
}
bool
FGPanel::getVisibility () const
{
- return _visibility;
+ return _visibility->getBoolValue();
}
FGPanel::setXOffset (int offset)
{
if (offset <= 0 && offset >= -_width + WIN_W)
- _x_offset = offset;
+ _x_offset->setIntValue( offset );
}
FGPanel::setYOffset (int offset)
{
if (offset <= 0 && offset >= -_height)
- _y_offset = offset;
+ _y_offset->setIntValue( offset );
}
/**
}
// Adjust for offsets.
- x -= _x_offset;
- y -= _y_offset;
+ x -= _x_offset->getIntValue();
+ y -= _y_offset->getIntValue();
// Having fixed up the coordinates, fall through to the local
// coordinate handler.
// X-offset
virtual void setXOffset (int offset);
- virtual int getXOffset () const { return _x_offset; }
+ virtual int getXOffset () const { return _x_offset->getIntValue(); }
// Y-offset.
virtual void setYOffset (int offset);
- virtual int getYOffset () const { return _y_offset; }
+ virtual int getYOffset () const { return _y_offset->getIntValue(); }
// View height.
virtual void setViewHeight (int height) { _view_height = height; }
void setupVirtualCockpit();
void cleanupVirtualCockpit();
- mutable bool _visibility;
mutable bool _mouseDown;
mutable int _mouseButton, _mouseX, _mouseY;
mutable int _mouseDelay;
typedef vector<FGPanelInstrument *> instrument_list_type;
int _width;
int _height;
- int _x_offset;
- int _y_offset;
int _view_height;
- float _jitter;
- bool _flipx;
+
+ SGPropertyNode * _visibility;
+ SGPropertyNode * _x_offset;
+ SGPropertyNode * _y_offset;
+ SGPropertyNode * _jitter;
+ SGPropertyNode * _flipx;
const SGPropertyNode * _xsize_node;
const SGPropertyNode * _ysize_node;