コード例 #1
0
/*
==============
CZWnd::Z_MouseMoved
==============
*/
void CZWnd::Z_MouseMoved( int x, int y, int buttons ) {
	if ( !buttons ) {
		return;
	}

	if ( buttons == MK_LBUTTON ) {
		Drag_MouseMoved( x, y, buttons );
		Sys_UpdateWindows( W_Z | W_CAMERA_ICON | W_XY );
		return;
	}

	// rbutton = drag z origin
	if ( buttons == MK_RBUTTON ) {
		if ( !( GetAsyncKeyState( VK_MENU ) & 0x8000 ) ) {
			Sys_GetCursorPos( &x, &y );
			if ( y != cursory ) {
				z.origin[2] += ( y - cursory ) / z.scale;	// sikk - Added "/ z.scale"
				::ShowCursor( FALSE );
				Sys_SetCursorPos( cursorx, cursory );
				Sys_UpdateWindows( W_Z );
			}

			return;
		}
	}

// ---> sikk - Mouse Zoom
	// rbutton + lbutton = zoom z view
	if ( buttons == ( MK_RBUTTON | MK_LBUTTON ) || ( buttons == MK_RBUTTON && ( GetAsyncKeyState( VK_MENU ) & 0x8000 ) ) ) {
		Sys_GetCursorPos( &x, &y );
		if ( y != cursory ) {
			z.scale += ( y - cursory ) * z.scale * 0.00390625f;
			if ( z.scale > 64.0f ) {
				z.scale = 64.0f;
			}
			if ( z.scale < 0.003125f ) {
				z.scale =  0.003125f;
			}
			::ShowCursor( FALSE );
			Sys_SetCursorPos( cursorx, cursory );
			Sys_UpdateWindows( W_Z );
		}
		return;
	}
// <--- sikk - Mouse Zoom


	// control mbutton = move camera
	int nMouseButton = g_PrefsDlg.m_nMouseButtons == 2 ? MK_RBUTTON : MK_MBUTTON;
	if ( ( buttons == ( MK_CONTROL | nMouseButton ) ) || ( buttons == ( MK_CONTROL | MK_LBUTTON ) ) ) {	
		g_pParentWnd->GetCamera()->Camera().origin[2] = z.origin[2] + ( y - ( z.height / 2 ) ) / z.scale;
		Sys_UpdateWindows( W_CAMERA | W_XY_OVERLAY | W_Z );
	}
}
コード例 #2
0
ファイル: z.cpp プロジェクト: etlegacy/GtkRadiant
/*
   ==============
   Z_MouseMoved
   ==============
 */
void Z_MouseMoved( int x, int y, int buttons ){
	if ( !buttons ) {
		return;
	}
	if ( buttons == MK_LBUTTON ) {
		Drag_MouseMoved( x, y, buttons );
		Sys_UpdateWindows( W_Z | W_CAMERA_IFON | W_XY );
		return;
	}
	// rbutton = drag z origin
	if ( buttons == MK_RBUTTON ) {
		Sys_GetCursorPos( &x, &y );
		if ( y != cursory ) {
			z.origin[2] += y - cursory;
			Sys_SetCursorPos( cursorx, cursory );
			Sys_UpdateWindows( W_Z );
		}
		return;
	}
	// control mbutton = move camera
	int nMouseButton = g_PrefsDlg.m_nMouseButtons == 2 ? MK_RBUTTON : MK_MBUTTON;
	if ( ( buttons == ( MK_CONTROL | nMouseButton ) ) || ( buttons == ( MK_CONTROL | MK_LBUTTON ) ) ) {
		g_pParentWnd->GetCamWnd()->Camera()->origin[2] = ( y - ( z.height / 2 ) ) / z.scale;
		Sys_UpdateWindows( W_CAMERA | W_XY_OVERLAY | W_Z );
	}

}
コード例 #3
0
ファイル: xy.c プロジェクト: amitahire/development
/*
==============
XY_MouseMoved
==============
*/
void XY_MouseMoved (int x, int y, int buttons)
{
	vec3_t	point;

	if (!buttonstate)
		return;

	// lbutton without selection = drag new brush
	if (buttonstate == MK_LBUTTON && !press_selection)
	{
		NewBrushDrag (x, y);
		return;
	}

	// lbutton (possibly with control and or shift)
	// with selection = drag selection
	if (buttonstate & MK_LBUTTON)
	{
		Drag_MouseMoved (x, y, buttons);
		Sys_UpdateWindows (W_XY_OVERLAY | W_CAMERA);
		return;
	}

	// control mbutton = move camera
	if (buttonstate == (MK_CONTROL|MK_MBUTTON) )
	{
		XY_ToPoint (x, y, point);
		camera.origin[0] = point[0];
		camera.origin[1] = point[1];
		Sys_UpdateWindows (W_XY_OVERLAY | W_CAMERA);
		return;
	}

	// shift mbutton = move z checker
	if (buttonstate == (MK_SHIFT|MK_MBUTTON) )
	{
		XY_ToPoint (x, y, point);
		z.origin[0] = point[0];
		z.origin[1] = point[1];
		Sys_UpdateWindows (W_XY_OVERLAY|W_Z);
		return;
	}

	// mbutton = angle camera
	if (buttonstate == MK_MBUTTON )
	{	
		XY_ToPoint (x, y, point);
		VectorSubtract (point, camera.origin, point);
		if (point[1] || point[0])
		{
			camera.angles[YAW] = 180/Q_PI*atan2 (point[1], point[0]);
			Sys_UpdateWindows (W_XY_OVERLAY | W_CAMERA);
		}
		return;
	}

	// rbutton = drag xy origin
	if (buttonstate == MK_RBUTTON)
	{
		Sys_GetCursorPos (&x, &y);
		if (x != cursorx || y != cursory)
		{
			g_qeglobals.d_xy.origin[0] -= (x-cursorx)/g_qeglobals.d_xy.scale;
			g_qeglobals.d_xy.origin[1] += (y-cursory)/g_qeglobals.d_xy.scale;
			Sys_SetCursorPos (cursorx, cursory);
			Sys_UpdateWindows (W_XY | W_XY_OVERLAY);
		}
		return;
	}
}