//------------------------------------------------------------------------------ void Input::init() { Con::printf( "Input Init:" ); destroy(); smActive = false; smLastKeyboardActivated = true; smLastMouseActivated = true; smLastJoystickActivated = true; SDL_InitSubSystem( SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_EVENTS ); // Init the current modifier keys setModifierKeys(0); fillAsciiTable(); Con::printf( "" ); // Set ourselves to participate in per-frame processing. Process::notify(Input::process, PROCESS_INPUT_ORDER); }
//------------------------------------------------------------------------------ void Input::init() { Con::printf( "Input Init:" ); destroy(); #ifdef TORQUE_DEFAULT_KEYBOARD_LAYOUT attemptSwitchToKeyboardLayout( TORQUE_DEFAULT_KEYBOARD_LAYOUT ); #endif #ifdef LOG_INPUT struct tm* newTime; time_t aclock; time( &aclock ); newTime = localtime( &aclock ); asctime( newTime ); gInputLog = CreateFile( L"input.log", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); log( "Input log opened at %s\n", asctime( newTime ) ); #endif smActive = false; smLastKeyboardActivated = true; smLastMouseActivated = true; smLastJoystickActivated = true; OSVERSIONINFO OSVersionInfo; dMemset( &OSVersionInfo, 0, sizeof( OSVERSIONINFO ) ); OSVersionInfo.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); if ( GetVersionEx( &OSVersionInfo ) ) { #ifdef LOG_INPUT log( "Operating System:\n" ); switch ( OSVersionInfo.dwPlatformId ) { case VER_PLATFORM_WIN32s: log( " Win32s on Windows 3.1 version %d.%d\n", OSVersionInfo.dwMajorVersion, OSVersionInfo.dwMinorVersion ); break; case VER_PLATFORM_WIN32_WINDOWS: log( " Windows 95 version %d.%d\n", OSVersionInfo.dwMajorVersion, OSVersionInfo.dwMinorVersion ); log( " Build number %d\n", LOWORD( OSVersionInfo.dwBuildNumber ) ); break; case VER_PLATFORM_WIN32_NT: log( " WinNT version %d.%d\n", OSVersionInfo.dwMajorVersion, OSVersionInfo.dwMinorVersion ); log( " Build number %d\n", OSVersionInfo.dwBuildNumber ); break; } if ( OSVersionInfo.szCSDVersion != NULL ) log( " %s\n", OSVersionInfo.szCSDVersion ); log( "\n" ); #endif if ( !( OSVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && OSVersionInfo.dwMajorVersion < 5 ) ) { smManager = new DInputManager; if ( !smManager->enable() ) { Con::printf( " DirectInput not enabled." ); delete smManager; smManager = NULL; } else { DInputManager::init(); Con::printf( " DirectInput enabled." ); } } else Con::printf( " WinNT detected -- DirectInput not enabled." ); } // Init the current modifier keys setModifierKeys(0); fillAsciiTable(); Con::printf( "" ); // Set ourselves to participate in per-frame processing. Process::notify(Input::process, PROCESS_INPUT_ORDER); }