2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2001-11-04 19:34:28 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
File: RageInput.h
|
|
|
|
|
|
2003-04-12 02:21:50 +00:00
|
|
|
This file just starts up input drivers, which generate InputEvents.
|
2001-11-04 19:34:28 +00:00
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-11-29 20:37:12 +00:00
|
|
|
Chris Danford
|
2001-11-04 19:34:28 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
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();
|
|
|
|
|
}
|