{
public:
FGMouseInputPrivate() :
+ initialized(false),
haveWarped(false),
xSizeNode(fgGetNode("/sim/startup/xsize", false ) ),
ySizeNode(fgGetNode("/sim/startup/ysize", false ) ),
mouse mice[MAX_MICE];
+ bool initialized;
bool hideCursor, haveWarped;
bool tooltipTimeoutDone;
bool clickTriggersTooltip;
void FGMouseInput::init()
{
+ if (d->initialized) {
+ SG_LOG(SG_INPUT, SG_WARN, "Duplicate init of FGMouseInput");
+
+ return;
+ }
+
+ d->initialized = true;
+
SG_LOG(SG_INPUT, SG_DEBUG, "Initializing mouse bindings");
std::string module = "";
void FGMouseInput::update ( double dt )
{
+ if (!d->initialized) {
+ SG_LOG(SG_INPUT, SG_WARN, "update of mouse before init");
+ }
+
mouse &m = d->mice[0];
int mode = m.mode_node->getIntValue();
if (mode != m.current_mode) {
void FGMouseInput::doMouseClick (int b, int updown, int x, int y, bool mainWindow, const osgGA::GUIEventAdapter* ea)
{
+ if (!d->initialized) {
+ // can occur during reset
+ return;
+ }
+
int modifiers = fgGetKeyModifiers();
mouse &m = d->mice[0];
void FGMouseInput::doMouseMotion (int x, int y, const osgGA::GUIEventAdapter* ea)
{
+ if (!d->initialized) {
+ // can occur during reset
+ return;
+ }
+
mouse &m = d->mice[0];
if (m.current_mode < 0 || m.current_mode >= m.nModes) {