This commit is contained in:
Glenn Maynard
2004-01-03 07:18:43 +00:00
parent 87d2e439eb
commit 6f1cac33c1
@@ -27,7 +27,7 @@ InputHandler_SDL::InputHandler_SDL()
#ifdef _XBOX
//strange hardware timing issue with 3rd party controllers
Sleep(750) ;
Sleep(750);
#endif
SDL_EnableKeyRepeat( 0, 0 );
@@ -88,13 +88,11 @@ InputHandler_SDL::~InputHandler_SDL()
void InputHandler_SDL::Update(float fDeltaTime)
{
#ifdef _XBOX
static int lastValX1 = 0 ;
static int lastValY1 = 0 ;
static int lastValX2 = 0 ;
static int lastValY2 = 0 ;
static int resolutionChanged = 0 ;
static int lastValX1 = 0;
static int lastValY1 = 0;
static int lastValX2 = 0;
static int lastValY2 = 0;
static int resolutionChanged = 0;
#endif
SDL_Event event;
@@ -133,57 +131,27 @@ void InputHandler_SDL::Update(float fDeltaTime)
case SDL_JOYAXISMOTION:
{
#ifdef _XBOX
resolutionChanged = 1 ;
/* XXX: If you want to adjust the screen, use the menu. Screen
* adjustment code doesn't belong in the input driver. */
resolutionChanged = 1;
if ( abs(event.jaxis.value) > 15600 )
{
switch ( event.jaxis.axis )
{
case 0 :
{
lastValX1 = event.jaxis.value ;
break;
}
case 1 :
{
lastValY1 = event.jaxis.value ;
break;
}
case 2 :
{
lastValX2 = event.jaxis.value ;
break;
}
case 3 :
{
lastValY2 = event.jaxis.value ;
break;
}
case 0: lastValX1 = event.jaxis.value; break;
case 1: lastValY1 = event.jaxis.value; break;
case 2: lastValX2 = event.jaxis.value; break;
case 3: lastValY2 = event.jaxis.value; break;
}
}
else
{
switch ( event.jaxis.axis )
{
case 0 :
{
lastValX1 = 0;
break;
}
case 1 :
{
lastValY1 = 0 ;
break;
}
case 2 :
{
lastValX2 = 0;
break;
}
case 3 :
{
lastValY2 = 0;
break;
}
case 0: lastValX1 = 0; break;
case 1: lastValY1 = 0; break;
case 2: lastValX2 = 0; break;
case 3: lastValY2 = 0; break;
}
}
#else
@@ -214,22 +182,22 @@ void InputHandler_SDL::Update(float fDeltaTime)
{
if ( lastValX1 || lastValY1 || lastValX2 || lastValY2 )
{
PREFSMAN->m_fScreenPosX += ((float)lastValX1/32767.0f) ;
PREFSMAN->m_fScreenPosX += ((float)lastValX1/32767.0f);
if ( PREFSMAN->m_fScreenPosX < 0)
PREFSMAN->m_fScreenPosX = 0 ;
PREFSMAN->m_fScreenPosX = 0;
PREFSMAN->m_fScreenPosY -= ((float)lastValY1/32767.0f) ;
PREFSMAN->m_fScreenPosY -= ((float)lastValY1/32767.0f);
if ( PREFSMAN->m_fScreenPosY < 0)
PREFSMAN->m_fScreenPosY = 0 ;
PREFSMAN->m_fScreenPosY = 0;
PREFSMAN->m_fScreenWidth += ((float)lastValX2/32767.0f) ;
PREFSMAN->m_fScreenHeight -= ((float)lastValY2/32767.0f) ;
PREFSMAN->m_fScreenWidth += ((float)lastValX2/32767.0f);
PREFSMAN->m_fScreenHeight -= ((float)lastValY2/32767.0f);
DISPLAY->ResolutionChanged() ;
DISPLAY->ResolutionChanged();
}
else
{
resolutionChanged = 0 ;
resolutionChanged = 0;
}
}
#endif