2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2001-11-03 10:52:42 +00:00
|
|
|
#include "RageInput.h"
|
2002-05-01 19:14:55 +00:00
|
|
|
#include "RageLog.h"
|
2003-04-12 02:21:50 +00:00
|
|
|
#include "RageException.h"
|
2003-06-29 07:02:03 +00:00
|
|
|
#include "arch/arch.h"
|
2003-02-16 02:25:22 +00:00
|
|
|
#include "arch/InputHandler/InputHandler.h"
|
2001-11-03 10:52:42 +00:00
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
RageInput* INPUTMAN = NULL; // globally accessable input device
|
2001-11-03 10:52:42 +00:00
|
|
|
|
2002-11-29 20:37:12 +00:00
|
|
|
RageInput::RageInput()
|
2001-11-03 10:52:42 +00:00
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "RageInput::RageInput()" );
|
2002-05-19 01:59:48 +00:00
|
|
|
|
2003-02-16 02:25:22 +00:00
|
|
|
/* Init optional devices. */
|
|
|
|
|
MakeInputHandlers(Devices);
|
2003-04-12 02:21:50 +00:00
|
|
|
|
|
|
|
|
/* If no input devices are loaded, the user won't be able to input anything.
|
|
|
|
|
* That should never happen. */
|
2003-07-22 07:47:27 +00:00
|
|
|
/* Temporarily commented out until Xbox is working. -Chris */
|
|
|
|
|
// if(Devices.size() == 0)
|
|
|
|
|
// RageException::Throw("No input devices were loaded. This shouldn't happen; please file a bug.");
|
2001-11-03 10:52:42 +00:00
|
|
|
}
|
|
|
|
|
|
2002-11-29 20:37:12 +00:00
|
|
|
RageInput::~RageInput()
|
2001-11-03 10:52:42 +00:00
|
|
|
{
|
2003-02-16 02:25:22 +00:00
|
|
|
/* Delete optional devices. */
|
2003-04-12 02:21:50 +00:00
|
|
|
for(unsigned i = 0; i < Devices.size(); ++i)
|
2003-02-16 02:25:22 +00:00
|
|
|
delete Devices[i];
|
2002-11-29 20:37:12 +00:00
|
|
|
}
|
2002-08-20 23:12:52 +00:00
|
|
|
|
2002-11-29 20:37:12 +00:00
|
|
|
void RageInput::Update( float fDeltaTime )
|
|
|
|
|
{
|
2003-02-16 02:25:22 +00:00
|
|
|
/* Update optional devices. */
|
|
|
|
|
for(unsigned i = 0; i < Devices.size(); ++i)
|
|
|
|
|
Devices[i]->Update(fDeltaTime);
|
2003-02-16 01:35:48 +00:00
|
|
|
}
|
2002-08-20 23:12:52 +00:00
|
|
|
|
2003-05-28 02:35:05 +00:00
|
|
|
void RageInput::GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut)
|
|
|
|
|
{
|
|
|
|
|
for(unsigned i = 0; i < Devices.size(); ++i)
|
|
|
|
|
Devices[i]->GetDevicesAndDescriptions( vDevicesOut, vDescriptionsOut );
|
|
|
|
|
}
|
2003-06-18 05:43:12 +00:00
|
|
|
|
|
|
|
|
void RageInput::WindowReset()
|
|
|
|
|
{
|
|
|
|
|
for(unsigned i = 0; i < Devices.size(); ++i)
|
|
|
|
|
Devices[i]->WindowReset();
|
|
|
|
|
}
|
2004-05-06 00:42:06 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2001-2004 Chris Danford, Glenn Maynard
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
|
|
|
* whom the Software is furnished to do so, provided that the above
|
|
|
|
|
* copyright notice(s) and this permission notice appear in all copies of
|
|
|
|
|
* the Software and that both the above copyright notice(s) and this
|
|
|
|
|
* permission notice appear in supporting documentation.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
|
|
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
|
|
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
|
|
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
|
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|