Example #1
0
/*
===============
IN_Shutdown
===============
*/
void IN_Shutdown()
{
	SDL_StopTextInput();
	IN_SetMouseMode(MouseMode::SystemCursor);
	mouseAvailable = false;

	IN_ShutdownJoystick();

	window = nullptr;
}
Example #2
0
void IN_SetVisibleMouse(bool visible)
{
#ifdef _WIN32
	bool lockEntered = MouseThread_ActiveLock_Enter();
#endif

	iVisibleMouse = visible;

	IN_SetMouseMode(!visible);

#ifdef _WIN32
	UpdateMouseThreadActive();
	if(lockEntered) MouseThread_ActiveLock_Exit();
#endif
}
Example #3
0
/*
===========
IN_DeactivateMouse
===========
*/
void CL_DLLEXPORT IN_DeactivateMouse (void)
{
	if (mouseinitialized)
	{
#ifdef _WIN32
		bool lockEntered = MouseThread_ActiveLock_Enter();
#endif

		IN_SetMouseMode(false);

		mouseactive = 0;

#ifdef _WIN32
		UpdateMouseThreadActive();
		if(lockEntered) MouseThread_ActiveLock_Exit();
#endif
	}
}
Example #4
0
/*
===========
IN_ActivateMouse
===========
*/
void CL_DLLEXPORT IN_ActivateMouse (void)
{
	if (mouseinitialized)
	{
#ifdef _WIN32
		bool lockEntered = MouseThread_ActiveLock_Enter();
#endif

		IN_SetMouseMode(true);

		mouseactive = 1;

#ifdef _WIN32
		UpdateMouseThreadActive();
		if(lockEntered) MouseThread_ActiveLock_Exit();
#endif

		// now is a good time to reset mouse positon:
		IN_ResetMouse();
	}
}
Example #5
0
/*
===============
IN_Init
===============
*/
void IN_Init( void *windowData )
{
	int appState;

	if ( !SDL_WasInit( SDL_INIT_VIDEO ) )
	{
		Com_Error( errorParm_t::ERR_FATAL, "IN_Init called before SDL_Init( SDL_INIT_VIDEO )" );
	}

	window = (SDL_Window*) windowData;

	Log::Debug( "------- Input Initialization -------" );

	in_keyboardDebug = Cvar_Get( "in_keyboardDebug", "0", CVAR_TEMP );

	// mouse variables
	in_mouse = Cvar_Get( "in_mouse", "1", 0 );
	in_nograb = Cvar_Get( "in_nograb", "0", 0 );

	in_joystick = Cvar_Get( "in_joystick", "0",  CVAR_LATCH );
	in_joystickDebug = Cvar_Get( "in_joystickDebug", "0", CVAR_TEMP );
	in_joystickThreshold = Cvar_Get( "in_joystickThreshold", "0.15", 0 );

	in_xbox360Controller = Cvar_Get( "in_xbox360Controller", "1", CVAR_TEMP );
	in_xbox360ControllerAvailable = Cvar_Get( "in_xbox360ControllerAvailable", "0", CVAR_ROM );
	in_xbox360ControllerDebug = Cvar_Get( "in_xbox360ControllerDebug", "0", CVAR_TEMP );
	SDL_StartTextInput();
	mouseAvailable = ( in_mouse->value != 0 );
	IN_SetMouseMode( MouseMode::CustomCursor );

	appState = SDL_GetWindowFlags( window );
	Cvar_SetValue( "com_unfocused", !( appState & SDL_WINDOW_INPUT_FOCUS ) );
	Cvar_SetValue( "com_minimized", ( appState & SDL_WINDOW_MINIMIZED ) );
	IN_InitJoystick();
	Log::Debug( "------------------------------------" );
}