mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
commit
8717c6a376
5 changed files with 1541 additions and 33 deletions
|
|
@ -27,15 +27,11 @@
|
|||
|
||||
#include "sdlInput.h"
|
||||
#include "platform/platformInput.h"
|
||||
#include "sdlInputManager.h"
|
||||
#include "SDL.h"
|
||||
|
||||
#ifdef LOG_INPUT
|
||||
#include <time.h>
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
// Static class variables:
|
||||
InputManager* Input::smManager;
|
||||
InputManager* Input::smManager = NULL;
|
||||
bool Input::smActive;
|
||||
U8 Input::smModifierKeys;
|
||||
bool Input::smLastKeyboardActivated;
|
||||
|
|
@ -43,10 +39,6 @@ bool Input::smLastMouseActivated;
|
|||
bool Input::smLastJoystickActivated;
|
||||
InputEvent Input::smInputEvent;
|
||||
|
||||
#ifdef LOG_INPUT
|
||||
static HANDLE gInputLog;
|
||||
#endif
|
||||
|
||||
static void fillAsciiTable() {}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -91,24 +83,17 @@ void Input::init()
|
|||
fillAsciiTable();
|
||||
Con::printf( "" );
|
||||
|
||||
smManager = new SDLInputManager;
|
||||
if (smManager)
|
||||
{
|
||||
SDLInputManager::init();
|
||||
}
|
||||
|
||||
// Set ourselves to participate in per-frame processing.
|
||||
Process::notify(Input::process, PROCESS_INPUT_ORDER);
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
DefineEngineFunction(isJoystickDetected, bool, (),, "")
|
||||
{
|
||||
return(SDL_NumJoysticks() > 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
DefineEngineFunction(getJoystickAxes, const char*, (const char* instance), , "")
|
||||
{
|
||||
// TODO SDL
|
||||
return("");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
U16 Input::getKeyCode( U16 asciiCode )
|
||||
{
|
||||
|
|
@ -159,6 +144,13 @@ void Input::destroy()
|
|||
|
||||
SDL_QuitSubSystem( SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER );
|
||||
|
||||
if (smManager)
|
||||
{
|
||||
if (smManager->isEnabled())
|
||||
smManager->disable();
|
||||
delete smManager;
|
||||
smManager = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -186,8 +178,8 @@ void Input::activate()
|
|||
//ImmReleaseContext( getWin32WindowHandle(), winState.imeHandle );
|
||||
#endif
|
||||
|
||||
if ( !Con::getBoolVariable( "$enableDirectInput" ) )
|
||||
return;
|
||||
if (smManager && !smManager->isEnabled())
|
||||
smManager->enable();
|
||||
|
||||
if ( smManager && smManager->isEnabled() && !smActive )
|
||||
{
|
||||
|
|
@ -199,7 +191,10 @@ void Input::activate()
|
|||
//------------------------------------------------------------------------------
|
||||
void Input::deactivate()
|
||||
{
|
||||
if ( smManager && smManager->isEnabled() && smActive )
|
||||
if (smManager && smManager->isEnabled())
|
||||
smManager->disable();
|
||||
|
||||
if (smActive)
|
||||
{
|
||||
smActive = false;
|
||||
Con::printf( "Input deactivated." );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue