コード例 #1
0
/*
===========
IN_StartupMouse
===========
*/
void IN_StartupMouse( void ) {
	s_wmv.mouseInitialized = qfalse;

	if ( in_mouse->integer == 0 ) {
		Com_Printf( "Mouse control not active.\n" );
		return;
	}

	s_wmv.mouseInitialized = qtrue;

#ifdef DI_SUPPORT
	// yay directinput for you
	// changed to 2 as pb was messing with me when I set it to -1
	if ( in_mouse->integer == 2 ) {
		directInput = IN_InitDInput();

		if ( directInput ) {
			Com_Printf( "DirectInput initialized\n" );
		} else {
			Com_Printf( "DirectInput not initialized\n" ); // or maybe not :(
		}
	}

	if ( !directInput ) {
#endif
	Cvar_Set( "in_mouse", "1" );    //fretn
	IN_InitWin32Mouse();
#ifdef DI_SUPPORT
}
#endif
}
コード例 #2
0
ファイル: in_win.cpp プロジェクト: flwh/Alcatel_OT_985_kernel
void IN_StartupMouse (void)
{
	HDC			hdc;

	if ( COM_CheckParm ("-nomouse") ) 
		return; 

	mouseinitialized = true;

	if (COM_CheckParm ("-dinput"))
	{
		dinput = IN_InitDInput ();

		if (dinput)
		{
			Con_SafePrintf ("DirectInput initialized\n");
		}
		else
		{
			Con_SafePrintf ("DirectInput not initialized\n");
		}
	}

	if (!dinput)
	{
		mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0);

		if (mouseparmsvalid)
		{
			if ( COM_CheckParm ("-noforcemspd") ) 
				newmouseparms[2] = originalmouseparms[2];

			if ( COM_CheckParm ("-noforcemaccel") ) 
			{
				newmouseparms[0] = originalmouseparms[0];
				newmouseparms[1] = originalmouseparms[1];
			}

			if ( COM_CheckParm ("-noforcemparms") ) 
			{
				newmouseparms[0] = originalmouseparms[0];
				newmouseparms[1] = originalmouseparms[1];
				newmouseparms[2] = originalmouseparms[2];
			}
		}
	}

	mouse_buttons = 3;

// if a fullscreen video mode was set before the mouse was initialized,
// set the mouse state appropriately
	if (mouseactivatetoggle)
		IN_ActivateMouse ();
}
コード例 #3
0
ファイル: win_input.c プロジェクト: Picmip/qfusion
/*
* IN_StartupMouse
*/
static void IN_StartupMouse( void ) {
	cvar_t *cv;

	cv = Cvar_Get( "in_initmouse", "1", CVAR_NOSET );
	if( !cv->integer ) {
		return;
	}

	dinput_initialized = false;
	rawinput_initialized = false;

	cv = Cvar_Get( "m_raw", "1", CVAR_ARCHIVE );
	if( cv->integer ) {
		rawinput_initialized = IN_RawInput_Init();
	}

	if( !rawinput_initialized ) {
		cv = Cvar_Get( "in_dinput", "0", CVAR_ARCHIVE );
		if( cv->integer ) {
			dinput_initialized = IN_InitDInput();
		}
	}

	if( rawinput_initialized ) {
		Com_Printf( "Raw input initialized with %i mice\n", rawmicecount );
	} else if( dinput_initialized ) {
		Com_Printf( "DirectInput initialized\n" );
	} else {
		Com_Printf( "DirectInput not initialized, using standard input\n" );
	}

	mouseinitialized = true;
	mouseparmsvalid = SystemParametersInfo( SPI_GETMOUSE, 0, originalmouseparms, 0 );
	mouse_buttons = 8;
	mouse_wheel_type = MWHEEL_UNKNOWN;
}
コード例 #4
0
ファイル: in_win.c プロジェクト: jite/jquake
void IN_ActivateMouse (void) 
{
	mouseactivatetoggle = true;

	if (mouseinitialized) 
	{
		#if DIRECTINPUT_VERSION	>= 0x0700
		if (dinput)
		{
			if (g_pMouse) 
			{
				if (!dinput_acquired) 
				{
					HRESULT		hr;

					// we may fail to reacquire if the window has been recreated
					hr = IDirectInputDevice_Acquire(g_pMouse);

					if (FAILED(hr)) 
					{
						if ( !IN_InitDInput() ) 
						{
							Com_Printf ("WARNING: can't reinitializing dinput mouse...\n");
							Com_Printf ("Falling back to Win32 mouse support...\n");
							Cvar_LatchedSetValue( &in_mouse, mt_normal );
							Cbuf_AddText ("in_restart\n");
						}
					}
					else
					{
						dinput_acquired = true;
					}
				}
			} 
			else 
			{
				return;
			}
		} else
		#endif // DIRECTINPUT_VERSION >= 0x700
		{
		#ifdef USINGRAWINPUT
			if (rawmicecount > 0)
			{
				if (IN_RawInput_Register()) {
					Com_Printf("Raw input: unable to register raw input, deinitializing\n");
					IN_RawInput_DeInit();
				}
			}
		#endif // USINGRAWINPUT

			if (mouseparmsvalid)
				restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0);

			IN_CenterMouseToWindow();
			SetCapture (mainwindow);
			ClipCursor (&window_rect);
		}
		mouseactive = true;
	}
}
コード例 #5
0
ファイル: in_win.c プロジェクト: jite/jquake
void IN_StartupMouse (void) 
{
	if (in_mouse.integer == mt_none)
		return;

	mouseinitialized = true;

	in_mwheeltype = MWHEEL_UNKNOWN;

#if DIRECTINPUT_VERSION	>= 0x0700
	if (in_mouse.integer == mt_dinput) 
	{
		dinput = IN_InitDInput();

		if (dinput) 
		{
			Com_Printf_State (PRINT_OK, "DirectInput initialized\n");
			mouse_buttons = 8;
			if (use_m_smooth)				
				Com_Printf_State (PRINT_OK, "Mouse smoothing initialized\n");
		} 
		else 
		{
			Com_Printf_State (PRINT_FAIL, "DirectInput not initialized\n");
		}
	}
#endif // DIRECTINPUT_VERSION	>= 0x0700

	if (!dinput) 
	{
		mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0);

		if (mouseparmsvalid) 
		{
			if (in_m_os_parameters.integer == 1)    
			{
				// Keeps the OS acceleration settings.
				newmouseparms[2] = originalmouseparms[2];
			}

			if (in_m_os_parameters.integer == 2) 
			{ 
				// Keeps the OS speed settings.
				newmouseparms[0] = originalmouseparms[0];
				newmouseparms[1] = originalmouseparms[1];
			}

            if (in_m_os_parameters.integer > 2) 
			{
				// Keeps both OS acceleration and speed settings.
				newmouseparms[0] = originalmouseparms[0];
				newmouseparms[1] = originalmouseparms[1];
				newmouseparms[2] = originalmouseparms[2];
			}
		}
		mouse_buttons = 8;

		#ifdef USINGRAWINPUT
		if (in_mouse.integer == mt_raw)
		{
			IN_RawInput_Init();
		}
		#endif // USINGRAWINPUT
	}

	// If a fullscreen video mode was set before the mouse was initialized, set the mouse state appropriately.
	if (mouseactivatetoggle)
		IN_ActivateMouse ();
}