Norman Vine wrote:
>
>David Megginson writes:
>>
>>I think that we're ready to switch over to the configurable mouse now
>>as the default, and to remove the old src/GUI/mouse.cxx code.
>>
>
>Hmm - I just updated from CVS and now clicking the right mouse button
>has no effect what so ever !
Oops sorry I see you updated the mice.xml again too :-)
FWIW
Here is a start at a 'positionable' mouse that I find makes the
new mouse MUCH easier to deal with when switching modes
and a doMouseMotion()
that is MUCH closer to what we had
Norman
=== cut ====
void
FGInput::_update_mouse ()
{
mouse &m = _mouse_bindings[0];
int mode = m.mode_node->getIntValue();
if (mode != m.current_mode) {
m.current_mode = mode;
glutWarpPointer( fgGetInt("/sim/startup/xsize", 800)/2,
fgGetInt("/sim/startup/ysize", 600)/2 );
if (mode >= 0 && mode < m.nModes) {
glutSetCursor(m.modes[mode].cursor);
} else {
SG_LOG(SG_INPUT, SG_DEBUG, "Mouse mode " << mode << " out of range");
glutSetCursor(GLUT_CURSOR_INHERIT);
}
}
}
void
FGInput::doMouseMotion (int x, int y)
{
int modifiers = FG_MOD_NONE; // FIXME: any way to get the real ones?
int xsize = fgGetInt("/sim/startup/xsize", 800);
int ysize = fgGetInt("/sim/startup/ysize", 600);
mouse &m = _mouse_bindings[0];
if (m.current_mode < 0 || m.current_mode >= m.nModes)
return;
mouse_mode &mode = m.modes[m.current_mode];
// Pass on to PUI if requested, and return
// if PUI consumed the event.
if (mode.pass_through && puMouse(x, y))
return;
// OK, PUI didn't want the event,
// so we can play with it.
if (x != m.x) {
int delta = x - m.x;
for (int i = 0; i < mode.x_bindings[modifiers].size(); i++)
mode.x_bindings[modifiers][i]->fire(double(delta), double(xsize));
}
if (y != m.y) {
int delta = y - m.y;
for (int i = 0; i < mode.y_bindings[modifiers].size(); i++)
mode.y_bindings[modifiers][i]->fire(double(delta), double(ysize));
}
// Constrain the mouse if requested
if (mode.constrained) {
bool need_warp = false;
if (x <= 0) {
x = xsize - 2;
need_warp = true;
} else if (x >= (xsize-1)) {
x = 0;
need_warp = true;
}
if (y <= 0) {
y = 1;
need_warp = true;
} else if (y >= (ysize-1)) {
y = ysize - 2;
need_warp = true;
}
if (need_warp)
glutWarpPointer(x, y);
}
m.x = x;
m.y = y;
}
_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel