mirror of https://github.com/stella-emu/stella.git
Paddle emulation from the keyboard and joystick axis is working! Still
TODO is add a scale factor (for each paddle) to the GUI, so one can adjust the speed/amount of movement. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@909 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
bde4172f50
commit
514ff4ea9a
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: EventHandler.cxx,v 1.126 2005-12-12 19:04:03 stephena Exp $
|
// $Id: EventHandler.cxx,v 1.127 2005-12-13 00:35:24 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -179,6 +179,12 @@ void EventHandler::reset(State state)
|
||||||
|
|
||||||
if(myState == S_LAUNCHER)
|
if(myState == S_LAUNCHER)
|
||||||
myUseLauncherFlag = true;
|
myUseLauncherFlag = true;
|
||||||
|
|
||||||
|
for(int i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
memset(&myPaddle[i], 0, sizeof(myJoyMouse));
|
||||||
|
myPaddle[i].amt = 70000; // FIXME - get scale factor from GUI and apply to this value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -187,7 +193,7 @@ void EventHandler::refreshDisplay()
|
||||||
// These are reset each time the display changes size
|
// These are reset each time the display changes size
|
||||||
myJoyMouse.x_max = myOSystem->frameBuffer().imageWidth();
|
myJoyMouse.x_max = myOSystem->frameBuffer().imageWidth();
|
||||||
myJoyMouse.y_max = myOSystem->frameBuffer().imageHeight();
|
myJoyMouse.y_max = myOSystem->frameBuffer().imageHeight();
|
||||||
myMouseMove = myOSystem->frameBuffer().zoomLevel() * 3;
|
myJoyMouse.amt = myOSystem->frameBuffer().zoomLevel() * 3;
|
||||||
|
|
||||||
switch(myState)
|
switch(myState)
|
||||||
{
|
{
|
||||||
|
@ -340,9 +346,9 @@ void EventHandler::poll(uInt32 time)
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
// Handle joystick to mouse emulation
|
// Handle joystick to mouse emulation FIXME
|
||||||
if(myEmulateMouseFlag)
|
// if(myEmulateMouseFlag)
|
||||||
handleJoyMouse(time);
|
// handleJoyMouse(time);
|
||||||
|
|
||||||
// Check for an event
|
// Check for an event
|
||||||
while(SDL_PollEvent(&event))
|
while(SDL_PollEvent(&event))
|
||||||
|
@ -743,6 +749,29 @@ void EventHandler::poll(uInt32 time)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle paddle emulation using joystick or key events
|
||||||
|
for(int i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
if(myPaddle[i].active)
|
||||||
|
{
|
||||||
|
myPaddle[i].x += myPaddle[i].x_amt;
|
||||||
|
if(myPaddle[i].x < 0)
|
||||||
|
{
|
||||||
|
myPaddle[i].x = 0; continue;
|
||||||
|
}
|
||||||
|
else if(myPaddle[i].x > 1000000)
|
||||||
|
{
|
||||||
|
myPaddle[i].x = 1000000; continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int resistance = (int)(1000000.0 * (1000000.0 - myPaddle[i].x) / 1000000.0);
|
||||||
|
myEvent->set(Paddle_Resistance[i], resistance);
|
||||||
|
cerr << "do paddle resistance for value = " << myPaddle[i].x << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update the current dialog container at regular intervals
|
// Update the current dialog container at regular intervals
|
||||||
// Used to implement continuous events
|
// Used to implement continuous events
|
||||||
if(myOverlay)
|
if(myOverlay)
|
||||||
|
@ -781,7 +810,7 @@ void EventHandler::handleMouseMotionEvent(SDL_Event& event)
|
||||||
if(myGrabMouseFlag) x = MIN(w, (int) (x * 1.5));
|
if(myGrabMouseFlag) x = MIN(w, (int) (x * 1.5));
|
||||||
|
|
||||||
int resistance = (int)(1000000.0 * (w - x) / w);
|
int resistance = (int)(1000000.0 * (w - x) / w);
|
||||||
handleEvent(Paddle_Resistance[myPaddleMode], resistance);
|
myEvent->set(Paddle_Resistance[myPaddleMode], resistance);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -853,91 +882,91 @@ void EventHandler::handleMouseButtonEvent(SDL_Event& event, int state)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::handleJoyMouse(uInt32 time)
|
void EventHandler::handleJoyMouse(JoyMouse& jm, uInt32 time)
|
||||||
{
|
{
|
||||||
bool mouseAccel = false; // TODO - make this a commandline option
|
bool mouseAccel = false; // TODO - make this a commandline option
|
||||||
|
|
||||||
if (time >= myJoyMouse.last_time + myJoyMouse.delay_time)
|
if (jm.active || (time >= jm.last_time + jm.delay_time))
|
||||||
{
|
{
|
||||||
myJoyMouse.last_time = time;
|
jm.last_time = time;
|
||||||
if (myJoyMouse.x_down_count == 1)
|
if (jm.x_down_count == 1)
|
||||||
{
|
{
|
||||||
myJoyMouse.x_down_time = time;
|
jm.x_down_time = time;
|
||||||
myJoyMouse.x_down_count = 2;
|
jm.x_down_count = 2;
|
||||||
}
|
}
|
||||||
if (myJoyMouse.y_down_count == 1)
|
if (jm.y_down_count == 1)
|
||||||
{
|
{
|
||||||
myJoyMouse.y_down_time = time;
|
jm.y_down_time = time;
|
||||||
myJoyMouse.y_down_count = 2;
|
jm.y_down_count = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myJoyMouse.x_vel || myJoyMouse.y_vel)
|
if (jm.x_vel || jm.y_vel)
|
||||||
{
|
{
|
||||||
if (myJoyMouse.x_down_count)
|
if (jm.x_down_count)
|
||||||
{
|
{
|
||||||
if (mouseAccel && time > myJoyMouse.x_down_time + myJoyMouse.delay_time * 12)
|
if (mouseAccel && time > jm.x_down_time + jm.delay_time * 12)
|
||||||
{
|
{
|
||||||
if (myJoyMouse.x_vel > 0)
|
if (jm.x_vel > 0)
|
||||||
myJoyMouse.x_vel++;
|
jm.x_vel++;
|
||||||
else
|
else
|
||||||
myJoyMouse.x_vel--;
|
jm.x_vel--;
|
||||||
}
|
}
|
||||||
else if (time > myJoyMouse.x_down_time + myJoyMouse.delay_time * 8)
|
else if (time > jm.x_down_time + jm.delay_time * 8)
|
||||||
{
|
{
|
||||||
if (myJoyMouse.x_vel > 0)
|
if (jm.x_vel > 0)
|
||||||
myJoyMouse.x_vel = myMouseMove;
|
jm.x_vel = jm.x_amt;
|
||||||
else
|
else
|
||||||
myJoyMouse.x_vel = -myMouseMove;
|
jm.x_vel = -jm.x_amt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (myJoyMouse.y_down_count)
|
if (jm.y_down_count)
|
||||||
{
|
{
|
||||||
if (mouseAccel && time > myJoyMouse.y_down_time + myJoyMouse.delay_time * 12)
|
if (mouseAccel && time > jm.y_down_time + jm.delay_time * 12)
|
||||||
{
|
{
|
||||||
if (myJoyMouse.y_vel > 0)
|
if (jm.y_vel > 0)
|
||||||
myJoyMouse.y_vel++;
|
jm.y_vel++;
|
||||||
else
|
else
|
||||||
myJoyMouse.y_vel--;
|
jm.y_vel--;
|
||||||
}
|
}
|
||||||
else if (time > myJoyMouse.y_down_time + myJoyMouse.delay_time * 8)
|
else if (time > jm.y_down_time + jm.delay_time * 8)
|
||||||
{
|
{
|
||||||
if (myJoyMouse.y_vel > 0)
|
if (jm.y_vel > 0)
|
||||||
myJoyMouse.y_vel = myMouseMove;
|
jm.y_vel = jm.x_amt;
|
||||||
else
|
else
|
||||||
myJoyMouse.y_vel = -myMouseMove;
|
jm.y_vel = -jm.x_amt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myJoyMouse.x += myJoyMouse.x_vel;
|
jm.x += jm.x_vel;
|
||||||
myJoyMouse.y += myJoyMouse.y_vel;
|
jm.y += jm.y_vel;
|
||||||
|
|
||||||
if (myJoyMouse.x < 0)
|
if (jm.x < 0)
|
||||||
{
|
{
|
||||||
myJoyMouse.x = 0;
|
jm.x = 0;
|
||||||
myJoyMouse.x_vel = -1;
|
jm.x_vel = -1;
|
||||||
myJoyMouse.x_down_count = 1;
|
jm.x_down_count = 1;
|
||||||
}
|
}
|
||||||
else if (myJoyMouse.x > myJoyMouse.x_max)
|
else if (jm.x > jm.x_max)
|
||||||
{
|
{
|
||||||
myJoyMouse.x = myJoyMouse.x_max;
|
jm.x = jm.x_max;
|
||||||
myJoyMouse.x_vel = 1;
|
jm.x_vel = 1;
|
||||||
myJoyMouse.x_down_count = 1;
|
jm.x_down_count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myJoyMouse.y < 0)
|
if (jm.y < 0)
|
||||||
{
|
{
|
||||||
myJoyMouse.y = 0;
|
jm.y = 0;
|
||||||
myJoyMouse.y_vel = -1;
|
jm.y_vel = -1;
|
||||||
myJoyMouse.y_down_count = 1;
|
jm.y_down_count = 1;
|
||||||
}
|
}
|
||||||
else if (myJoyMouse.y > myJoyMouse.y_max)
|
else if (jm.y > jm.y_max)
|
||||||
{
|
{
|
||||||
myJoyMouse.y = myJoyMouse.y_max;
|
jm.y = myJoyMouse.y_max;
|
||||||
myJoyMouse.y_vel = 1;
|
jm.y_vel = 1;
|
||||||
myJoyMouse.y_down_count = 1;
|
jm.y_down_count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_WarpMouse(myJoyMouse.x, myJoyMouse.y);
|
//FIXME SDL_WarpMouse(myJoyMouse.x, myJoyMouse.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1036,7 +1065,7 @@ void EventHandler::handleJoyAxisEvent(int stick, int axis, int value)
|
||||||
}
|
}
|
||||||
else if(value < 0)
|
else if(value < 0)
|
||||||
{
|
{
|
||||||
if(0)//isPaddleEvent(eventAxisNeg))
|
if(0)//stick is analog && isPaddleEvent(eventAxisNeg))
|
||||||
{
|
{
|
||||||
// turn on paddle event defined here
|
// turn on paddle event defined here
|
||||||
}
|
}
|
||||||
|
@ -1045,7 +1074,7 @@ void EventHandler::handleJoyAxisEvent(int stick, int axis, int value)
|
||||||
}
|
}
|
||||||
else // value > 0
|
else // value > 0
|
||||||
{
|
{
|
||||||
if(0)//isPaddleEvent(eventAxisPos))
|
if(0)//stick is analog && isPaddleEvent(eventAxisPos))
|
||||||
{
|
{
|
||||||
// turn on paddle event defined here
|
// turn on paddle event defined here
|
||||||
}
|
}
|
||||||
|
@ -1053,57 +1082,6 @@ void EventHandler::handleJoyAxisEvent(int stick, int axis, int value)
|
||||||
handleEvent(eventAxisPos, 1);
|
handleEvent(eventAxisPos, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if(1)//isPaddleEvent(eventAxisNeg) || isPaddleEvent(eventAxisPos))
|
|
||||||
{
|
|
||||||
if(value == 0)
|
|
||||||
{
|
|
||||||
// turn off paddle movement
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Event::type event = value < 0 ? eventAxisNeg : eventAxisPos;
|
|
||||||
int dir = 0;
|
|
||||||
switch((int)event)
|
|
||||||
{
|
|
||||||
case Event::PaddleZeroDecrease:
|
|
||||||
cerr << "paddle 0 decrease\n";
|
|
||||||
break;
|
|
||||||
case Event::PaddleZeroIncrease:
|
|
||||||
cerr << "paddle 0 increase\n";
|
|
||||||
break;
|
|
||||||
case Event::PaddleOneDecrease:
|
|
||||||
cerr << "paddle 1 decrease\n";
|
|
||||||
break;
|
|
||||||
case Event::PaddleOneIncrease:
|
|
||||||
cerr << "paddle 1 increase\n";
|
|
||||||
break;
|
|
||||||
case Event::PaddleTwoDecrease:
|
|
||||||
cerr << "paddle 2 decrease\n";
|
|
||||||
break;
|
|
||||||
case Event::PaddleTwoIncrease:
|
|
||||||
cerr << "paddle 2 increase\n";
|
|
||||||
break;
|
|
||||||
case Event::PaddleThreeDecrease:
|
|
||||||
cerr << "paddle 3 decrease\n";
|
|
||||||
break;
|
|
||||||
case Event::PaddleThreeIncrease:
|
|
||||||
cerr << "paddle 3 increase\n";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // Otherwise, treat values as digital
|
|
||||||
{
|
|
||||||
if(value == 0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else if(value < 0)
|
|
||||||
else
|
|
||||||
handleEvent(eventAxisPos, 1);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// FIXME - This isn't ready for production use just yet ...
|
// FIXME - This isn't ready for production use just yet ...
|
||||||
// Determine what type of axis we're dealing with
|
// Determine what type of axis we're dealing with
|
||||||
|
@ -1196,36 +1174,62 @@ void EventHandler::handleEvent(Event::Type event, int state)
|
||||||
case Event::JoystickZeroUp:
|
case Event::JoystickZeroUp:
|
||||||
if(state) myEvent->set(Event::JoystickZeroDown, 0);
|
if(state) myEvent->set(Event::JoystickZeroDown, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Event::JoystickZeroDown:
|
case Event::JoystickZeroDown:
|
||||||
if(state) myEvent->set(Event::JoystickZeroUp, 0);
|
if(state) myEvent->set(Event::JoystickZeroUp, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Event::JoystickZeroLeft:
|
case Event::JoystickZeroLeft:
|
||||||
if(state) myEvent->set(Event::JoystickZeroRight, 0);
|
if(state) myEvent->set(Event::JoystickZeroRight, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Event::JoystickZeroRight:
|
case Event::JoystickZeroRight:
|
||||||
if(state) myEvent->set(Event::JoystickZeroLeft, 0);
|
if(state) myEvent->set(Event::JoystickZeroLeft, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Event::JoystickOneUp:
|
case Event::JoystickOneUp:
|
||||||
if(state) myEvent->set(Event::JoystickOneDown, 0);
|
if(state) myEvent->set(Event::JoystickOneDown, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Event::JoystickOneDown:
|
case Event::JoystickOneDown:
|
||||||
if(state) myEvent->set(Event::JoystickOneUp, 0);
|
if(state) myEvent->set(Event::JoystickOneUp, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Event::JoystickOneLeft:
|
case Event::JoystickOneLeft:
|
||||||
if(state) myEvent->set(Event::JoystickOneRight, 0);
|
if(state) myEvent->set(Event::JoystickOneRight, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Event::JoystickOneRight:
|
case Event::JoystickOneRight:
|
||||||
if(state) myEvent->set(Event::JoystickOneLeft, 0);
|
if(state) myEvent->set(Event::JoystickOneLeft, 0);
|
||||||
break;
|
break;
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
case Event::PaddleZeroDecrease:
|
||||||
|
myPaddle[0].active = (bool) state;
|
||||||
|
myPaddle[0].x_amt = -myPaddle[0].amt;
|
||||||
|
return;
|
||||||
|
case Event::PaddleZeroIncrease:
|
||||||
|
myPaddle[0].active = (bool) state;
|
||||||
|
myPaddle[0].x_amt = myPaddle[0].amt;
|
||||||
|
return;
|
||||||
|
case Event::PaddleOneDecrease:
|
||||||
|
myPaddle[1].active = (bool) state;
|
||||||
|
myPaddle[1].x_amt = -myPaddle[1].amt;
|
||||||
|
return;
|
||||||
|
case Event::PaddleOneIncrease:
|
||||||
|
myPaddle[1].active = (bool) state;
|
||||||
|
myPaddle[1].x_amt = myPaddle[1].amt;
|
||||||
|
return;
|
||||||
|
case Event::PaddleTwoDecrease:
|
||||||
|
myPaddle[2].active = (bool) state;
|
||||||
|
myPaddle[2].x_amt = -myPaddle[2].amt;
|
||||||
|
return;
|
||||||
|
case Event::PaddleTwoIncrease:
|
||||||
|
myPaddle[2].active = (bool) state;
|
||||||
|
myPaddle[2].x_amt = myPaddle[2].amt;
|
||||||
|
return;
|
||||||
|
case Event::PaddleThreeDecrease:
|
||||||
|
myPaddle[3].active = (bool) state;
|
||||||
|
myPaddle[3].x_amt = -myPaddle[3].amt;
|
||||||
|
return;
|
||||||
|
case Event::PaddleThreeIncrease:
|
||||||
|
myPaddle[3].active = (bool) state;
|
||||||
|
myPaddle[3].x_amt = myPaddle[3].amt;
|
||||||
|
return;
|
||||||
|
|
||||||
case Event::NoType: // Ignore unmapped events
|
case Event::NoType: // Ignore unmapped events
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1754,18 +1758,24 @@ bool EventHandler::isValidList(string& list, IntArray& map, uInt32 length)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline bool EventHandler::eventIsAnalog(Event::Type event)
|
inline bool EventHandler::eventIsAnalog(Event::Type event)
|
||||||
{
|
{
|
||||||
bool analog = false;
|
|
||||||
switch((int)event)
|
switch((int)event)
|
||||||
{
|
{
|
||||||
case Event::PaddleZeroResistance:
|
case Event::PaddleZeroResistance:
|
||||||
|
case Event::PaddleZeroDecrease:
|
||||||
|
case Event::PaddleZeroIncrease:
|
||||||
case Event::PaddleOneResistance:
|
case Event::PaddleOneResistance:
|
||||||
|
case Event::PaddleOneDecrease:
|
||||||
|
case Event::PaddleOneIncrease:
|
||||||
case Event::PaddleTwoResistance:
|
case Event::PaddleTwoResistance:
|
||||||
|
case Event::PaddleTwoDecrease:
|
||||||
|
case Event::PaddleTwoIncrease:
|
||||||
case Event::PaddleThreeResistance:
|
case Event::PaddleThreeResistance:
|
||||||
analog = true;
|
case Event::PaddleThreeDecrease:
|
||||||
break;
|
case Event::PaddleThreeIncrease:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return analog;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: EventHandler.hxx,v 1.64 2005-12-12 19:04:03 stephena Exp $
|
// $Id: EventHandler.hxx,v 1.65 2005-12-13 00:35:24 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef EVENTHANDLER_HXX
|
#ifndef EVENTHANDLER_HXX
|
||||||
|
@ -92,7 +92,7 @@ struct Stella_Joystick {
|
||||||
mapping can take place.
|
mapping can take place.
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: EventHandler.hxx,v 1.64 2005-12-12 19:04:03 stephena Exp $
|
@version $Id: EventHandler.hxx,v 1.65 2005-12-13 00:35:24 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class EventHandler
|
class EventHandler
|
||||||
{
|
{
|
||||||
|
@ -295,6 +295,14 @@ class EventHandler
|
||||||
inline bool frying() { return myFryingFlag; }
|
inline bool frying() { return myFryingFlag; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Used for joystick to mouse emulation
|
||||||
|
struct JoyMouse {
|
||||||
|
bool active;
|
||||||
|
int x, y, x_vel, y_vel, x_max, y_max, x_amt, y_amt, amt,
|
||||||
|
x_down_count, y_down_count;
|
||||||
|
unsigned int last_time, delay_time, x_down_time, y_down_time;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Send a mouse motion event to the handler.
|
Send a mouse motion event to the handler.
|
||||||
|
|
||||||
|
@ -339,9 +347,10 @@ class EventHandler
|
||||||
/**
|
/**
|
||||||
Handle joystick movement emulating mouse motion
|
Handle joystick movement emulating mouse motion
|
||||||
|
|
||||||
@param time Current millisecond count
|
@param jm JoyMouse structure to modify
|
||||||
|
@param time Current millisecond count
|
||||||
*/
|
*/
|
||||||
void handleJoyMouse(uInt32 time);
|
void handleJoyMouse(JoyMouse& jm, uInt32 time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Detects and changes the eventhandler state
|
Detects and changes the eventhandler state
|
||||||
|
@ -458,13 +467,8 @@ class EventHandler
|
||||||
// The current joymap in string form
|
// The current joymap in string form
|
||||||
string myJoymapString;
|
string myJoymapString;
|
||||||
|
|
||||||
// Used for joystick to mouse emulation
|
|
||||||
struct JoyMouse {
|
|
||||||
int x, y, x_vel, y_vel, x_max, y_max, x_down_count, y_down_count;
|
|
||||||
unsigned int last_time, delay_time, x_down_time, y_down_time;
|
|
||||||
};
|
|
||||||
|
|
||||||
JoyMouse myJoyMouse;
|
JoyMouse myJoyMouse;
|
||||||
|
JoyMouse myPaddle[4];
|
||||||
|
|
||||||
// How far the joystick will move the mouse on each frame tick
|
// How far the joystick will move the mouse on each frame tick
|
||||||
int myMouseMove;
|
int myMouseMove;
|
||||||
|
|
Loading…
Reference in New Issue