当前位置: 首页>>代码示例>>C++>>正文


C++ GetMousePos函数代码示例

本文整理汇总了C++中GetMousePos函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMousePos函数的具体用法?C++ GetMousePos怎么用?C++ GetMousePos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetMousePos函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetMousePart

void ScrollBar::LeftDown(Point p, dword) {
	push = GetMousePart();
	LLOG("ScrollBar::LeftDown(" << p << ")");
	LLOG("MousePos = " << GetMousePos() << ", ScreenView = " << GetScreenView()
	<< ", rel. pos = " << (GetMousePos() - GetScreenView().TopLeft()));
	LLOG("GetWorkArea = " << GetWorkArea());
	LLOG("VisibleScreenView = " << GetVisibleScreenView());
	LLOG("PartRect(0) = " << GetPartRect(0));
	LLOG("PartRect(1) = " << GetPartRect(1));
	LLOG("PartRect(2) = " << GetPartRect(2));
	LLOG("ScrollBar::LeftDown: mousepart = " << (int)push << ", rect = " << GetPartRect(push)
		<< ", overthumb = " << style->overthumb << ", slider = " << Slider());
	LLOG("thumbpos = " << thumbpos << ", thumbsize = " << thumbsize);
	if(push == 2)
		delta = GetHV(p.x, p.y) - thumbpos;
	else {
		if(jump) {
			delta = thumbsize / 2;
			Drag(p);
		}
		else
			if(push == 0)
				PrevPage();
			else
				NextPage();
	}
	SetCapture();
	Refresh();
	WhenLeftClick();
}
开发者ID:pedia,项目名称:raidget,代码行数:30,代码来源:ScrollBar.cpp

示例2: ShowToolTip

void ShowToolTip()
{
	LLOG("ShowToolTip");
	CloseToolTip();
	if(tipctrl) {
		String text = tipctrl->GetTip();
		LLOG("-> showing tip: " << text << " tipctrl: " << UPP::Name(tipctrl));
		Ctrl *top = tipctrl->GetTopCtrl();
		if(!text.IsEmpty() && top && (top->IsForeground() || top->IsPopUp())) {
			LLOG("-> foreground");
			ToolTip& q = AppToolTip();
			q.Set(text);
			Size sz = q.GetMinSize();
			Rect r = top->GetWorkArea();
			Point p = GetMousePos() + Size(0, 22);
			if(p.y + sz.cy > r.bottom)
				p = GetMousePos() - Size(0, 22);
			q.PopUp(top, p, !showmode);
			showmode = true;
			KillTimeCallback((void *)EndShowMode);
			return;
		}
		LLOG("-> background / empty text, top = " << UPP::Name(top));
	}
	SetTimeCallback(200, callback(EndShowMode), (void *)EndShowMode);
}
开发者ID:pedia,项目名称:raidget,代码行数:26,代码来源:ToolTip.cpp

示例3: defined

//-----------------------------------------------------------------------------
// Purpose: AccumulateMouse
//-----------------------------------------------------------------------------
void CInput::AccumulateMouse( void )
{
	if( !cl_mouseenable.GetBool() )
	{
		return;
	}

	if( !cl_mouselook.GetBool() )
	{
		return;
	}

	if ( m_rawinput.GetBool() )
	{
		return;
	}

	int w, h;
	engine->GetScreenSize( w, h );

	// x,y = screen center
	int x = w >> 1;	x;
	int y = h >> 1;	y;

	//only accumulate mouse if we are not moving the camera with the mouse
	if ( !m_fCameraInterceptingMouse && vgui::surface()->IsCursorLocked() )
	{
		//Assert( !vgui::surface()->IsCursorVisible() );
		// By design, we follow the old mouse path even when using SDL for Windows, to retain old mouse behavior.
#if defined( PLATFORM_WINDOWS )
		int current_posx, current_posy;

		GetMousePos(current_posx, current_posy);

		m_flAccumulatedMouseXMovement += current_posx - x;
		m_flAccumulatedMouseYMovement += current_posy - y;
		
#elif defined( USE_SDL )
		int dx, dy;
		engine->GetMouseDelta( dx, dy );
		m_flAccumulatedMouseXMovement += dx;
		m_flAccumulatedMouseYMovement += dy;
#else
#error
#endif
		// force the mouse to the center, so there's room to move
		ResetMouse();
	}
	else if ( m_fMouseActive )
	{
		// Clamp
		int ox, oy;
		GetMousePos( ox, oy );
		ox = clamp( ox, 0, w - 1 );
		oy = clamp( oy, 0, h - 1 );
		SetMousePos( ox, oy );
	}


}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:63,代码来源:in_mouse.cpp

示例4: switch

Image RichEdit::CursorImage(Point p, dword flags)
{
	if(tablesel)
		return Image::Arrow();

	switch(GetHotSpot(p)) {
	case 0:
		return Image::SizeBottomRight();
	case 1:
		return Image::SizeVert();
	case 2:
		return Image::SizeHorz();
	default:
		if(text.GetRichPos(GetMousePos(p)).object) {
			return Image::Arrow();
		}
		else
		if(HasCapture() && tabmove.table && tabmove.column >= -2)
			return Image::SizeHorz();
		else {
			RichHotPos hp = GetHotPos(p);
			if(hp.table > 0)
				return Image::SizeHorz();
			else {
				int c = GetMousePos(p);
				return InSelection(c) && !HasCapture() ? Image::Arrow() : Image::IBeam();
			}
		}
	}
	return Image::Arrow();
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:31,代码来源:Mouse.cpp

示例5: GetMousePos

//-----------------------------------------------------------------------------
// Purpose: AccumulateMouse
//-----------------------------------------------------------------------------
void CInput::AccumulateMouse( int nSlot )
{
	if( !cl_mouseenable.GetBool() )
	{
		return;
	}

	if( !UsingMouselook( nSlot ) )
	{
		return;
	}

	int w, h;
	engine->GetScreenSize( w, h );

	// x,y = screen center
	int x = w >> 1;
	int y = h >> 1;

	// Clamp
	if ( m_fMouseActive )
	{
		int ox, oy;
		GetMousePos( ox, oy );
		ox = clamp( ox, 0, w - 1 );
		oy = clamp( oy, 0, h - 1 );
		SetMousePos( ox, oy );
	}

	//only accumulate mouse if we are not moving the camera with the mouse
	PerUserInput_t &user = GetPerUser( nSlot );

	if ( !user.m_fCameraInterceptingMouse && vgui::surface()->IsCursorLocked() )
	{
		//Assert( !vgui::surface()->IsCursorVisible() );

#ifdef WIN32
		int current_posx, current_posy;

		GetMousePos(current_posx, current_posy);

		user.m_flAccumulatedMouseXMovement += current_posx - x;
		user.m_flAccumulatedMouseYMovement += current_posy - y;

		// force the mouse to the center, so there's room to move
		ResetMouse();
#elif defined(OSX)
		CGMouseDelta deltaX, deltaY;
		CGGetLastMouseDelta( &deltaX, &deltaY );
		user.m_flAccumulatedMouseXMovement += deltaX;
		user.m_flAccumulatedMouseYMovement += deltaY;
#else
#error
#endif
	}
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:59,代码来源:in_mouse.cpp

示例6: if

void CView::ClickingLeftButtonEvent()
{
	if (m_pMenu && !m_pMenu->GetMenuWorkSpaceRect().contains(GetMousePos(*m_pWindow)))
	{
		m_pMenu.release();
		m_pMenu = nullptr;
	}
	else if (m_pFrame->GetStartMousePos().x == OUTSTIDE_WORKSPACE_POS)
	{
		m_pFrame->SetStartMousePos(GetMousePos(*m_pWindow));
	}
	m_mouseClicked = true;
}
开发者ID:oMystique,项目名称:OOP,代码行数:13,代码来源:view.cpp

示例7: UpdateUniformsV

void clGUIWindow::PreRender()
{
	clGUIDialogWindow::PreRender();

	static const float ResizeCornerW = Env->GUI->GetDefaultResizeCornerWidth();
	static const float ResizeCornerH = Env->GUI->GetDefaultResizeCornerHeight();

	UpdateUniformsV( FResizeCornerShader, LVector4( GetX2(), GetY2(), GetX2() - ResizeCornerW, GetY2() + ResizeCornerH ) );
	UpdateUniformsV( FResizeCornerHighlightShader, LVector4( GetX2(), GetY2(), GetX2() - ResizeCornerW, GetY2() + ResizeCornerH ) );

	FResizeCornerHighlighted ?
	Env->Renderer->AddBuffer( FResizeCornerGeometry, FResizeCornerHighlightShader, 1, false ) :
	Env->Renderer->AddBuffer( FResizeCornerGeometry, FResizeCornerShader, 1, false );

	static const float CloseButtonW    = Env->GUI->GetDefaultCloseButtonWidth();
	static const float CloseButtonH_D1 = Env->GUI->GetDefaultCloseButtonHeight_Delta1();
	static const float CloseButtonH_D2 = Env->GUI->GetDefaultCloseButtonHeight_Delta2();

	if ( FCloseButtonHighlighted )
	{
		UpdateUniformsV( FCloseButtonHighlightShader, LVector4( GetX2() - CloseButtonW, GetY1() + CloseButtonH_D1, GetX2(), GetY1() + CloseButtonH_D2 ) );
		Env->Renderer->AddBuffer( FCloseButtonGeometry, FCloseButtonHighlightShader, 1, false );
	}
	else
	{
		UpdateUniformsV( FCloseButtonShader, LVector4( GetX2() - CloseButtonW, GetY1() + CloseButtonH_D1, GetX2(), GetY1() + CloseButtonH_D2 ) );
		UpdateUniformsV( FCloseButtonCaptionHighlightedShader, LVector4( GetX2() - CloseButtonW, GetY1() + CloseButtonH_D1, GetX2(), GetY1() + CloseButtonH_D2 ) );

		ContainsCaption( Local2Screen( GetMousePos() ) ) ?
		Env->Renderer->AddBuffer( FCloseButtonGeometry, FCloseButtonCaptionHighlightedShader, 1, false ) :
		Env->Renderer->AddBuffer( FCloseButtonGeometry, FCloseButtonShader, 1, false );
	}
}
开发者ID:berezhkovskaya,项目名称:Carousel3D,代码行数:33,代码来源:I_Window.cpp

示例8: GetMousePos

void DockWindow::ContainerDragStart(DockCont &dc)
{
	if (!dc.IsFloating()) {
		// Reposition if not under the mouse
		Rect r = dc.GetScreenRect();
		Point pt = GetMousePos();
		Point tl = r.TopLeft();
		bool move = false;
		if (r.left > pt.x || r.right < pt.x) {
			tl.x += pt.x - r.left - r.Width()/2;
			move = true;
		}
		if (r.top < pt.y) {
			tl.y += pt.y - r.top + DOCKCONT_WND_OFFSET;
			move = true;
		}
		// Note: Due to different bugfix, at this point a dragged tab will have docked state but
		//	no parent and should not be animatehld
		dc.SyncUserSize(true, true);
		if (IsAnimatedHighlight() && dc.IsDocked() && dc.GetParent()) {
			Undock0(dc, true);
			dc.StateNotDocked();
		}
		FloatContainer(dc, move ? tl : Null);
		dc.StartMouseDrag(pt);
	}
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:27,代码来源:DockWindow.cpp

示例9: GetMousePos

ALERROR AGScreen::AddArea (AGArea *pArea, const RECT &rcRect, DWORD dwTag)

//	AddArea
//
//	Add an area to the screen

	{
	ALERROR error;

	//	Initialize the area

	if (error = pArea->Init(this, this, rcRect, dwTag))
		return error;

	//	Add the area

	if (error = m_Areas.AppendObject(pArea, NULL))
		return error;

	//	Get the mouse position and fire mouse move, if appropriate

	POINT pt;
	GetMousePos(&pt);

	if (HitTest(pt) == pArea)
		SetMouseOver(pArea);

	return NOERROR;
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:29,代码来源:AGScreen.cpp

示例10: PSERROR_GUI_OperationNeedsGUIObject

bool IGUIObject::MouseOver()
{
	if (!GetGUI())
		throw PSERROR_GUI_OperationNeedsGUIObject();

	return m_CachedActualSize.PointInside(GetMousePos());
}
开发者ID:Rektosauros,项目名称:0ad,代码行数:7,代码来源:IGUIObject.cpp

示例11: Sync

void DisplayPopup::Sync()
{
	if(display && ctrl && !ctrl->IsDragAndDropTarget() && !IsDragAndDropTarget()) {
		Ctrl *top = ctrl->GetTopCtrl();
		if(top && top->HasFocusDeep()) {
			Size sz = display->GetStdSize(value);
			if(sz.cx + 2 * margin > item.GetWidth() || sz.cy > item.GetHeight()) {
				slim = item + ctrl->GetScreenView().TopLeft();
				if(slim.Contains(GetMousePos())) {
//					Rect wa = GetWorkArea();
					Rect r = item;
					r.right = max(r.right, r.left + sz.cx + 2 * margin);
					r.bottom = max(r.bottom, r.top + sz.cy);
					r.Inflate(1, 1);
					r.Offset(ctrl->GetScreenView().TopLeft());
					SetRect(r);
					if(!IsOpen())
						Ctrl::PopUp(ctrl, true, false, false);
					Refresh();
					return;
				}
			}
		}
	}
	if(IsOpen())
		Close();
}
开发者ID:pedia,项目名称:raidget,代码行数:27,代码来源:LabelBase.cpp

示例12: IncUsageRef

// Do you have any idea how much I wanted to call 
// this ElvisHasLeftTheBuilding()?
void Window::MouseHasLeftWindow(void)
{
    IncUsageRef();

    string StatusControlName = string("WindowStatus");
    m_pTheme->HandleControlMessage(StatusControlName, CM_WindowLeave);

    if (m_pMouseInControl)
    {
       m_pMouseInControl->AcceptTransition(CT_MouseLeave);
       m_pMouseInControl = NULL;
    }
    else if (!m_pMouseInControl)
    { 
       Pos oPos;

       GetMousePos(oPos);
       m_pMouseInControl = ControlFromPos(oPos);
       if (m_pMouseInControl) {
          m_pMouseInControl->AcceptTransition(CT_MouseEnter);
          m_pTheme->HandleControlMessage(StatusControlName, CM_WindowEnter);
       }
    }      
    DecUsageRef();
}
开发者ID:pontocom,项目名称:opensdrm,代码行数:27,代码来源:Window.cpp

示例13: Close

void QTFPopUp::PopUp(Ctrl *parent) {
	Close();
	Rect r = Rect(0, 0, width, maxheight);
	GetFrame().FrameLayout(r);
	int cy = min(maxheight, GetHeight(r.Width()) + maxheight - r.Height());
	Rect area = GetWorkArea();
	Point p = GetMousePos();
	r.top = max(area.top, p.y + 16);
	r.bottom = r.top + cy;
	if(r.bottom > area.bottom) {
		r.bottom = area.bottom;
		r.top = r.bottom - cy;
	}
	r.left = max(area.left, p.x - width / 2);
	r.right = r.left + width;
	if(r.right > area.right) {
		r.right = area.right;
		r.left = r.right - width;
	}
	open = false;
	SetRect(r);
	Ctrl::PopUp(parent);
	SetFocus();
	open = true;
}
开发者ID:pedia,项目名称:raidget,代码行数:25,代码来源:ToolTip.cpp

示例14: GetMousePos

void LineEdit::LeftRepeat(Point p, dword flags) {
	if(HasCapture()) {
		int c = GetMousePos(p);
		if(mpos != c)
			PlaceCaret(c, true);
	}
}
开发者ID:pedia,项目名称:raidget,代码行数:7,代码来源:LineEdit.cpp

示例15: GetWindowCenter

//-----------------------------------------------------------------------------
// Purpose: AccumulateMouse
//-----------------------------------------------------------------------------
void CInput::AccumulateMouse( void )
{
	if( !cl_mouseenable.GetBool() )
	{
		return;
	}

	if( !cl_mouselook.GetBool() )
	{
		return;
	}

	int x, y;
	GetWindowCenter( x,  y );

	//only accumulate mouse if we are not moving the camera with the mouse
	if ( !m_fCameraInterceptingMouse && vgui::surface()->IsCursorLocked() )
	{
		//Assert( !vgui::surface()->IsCursorVisible() );

		int current_posx, current_posy;

		GetMousePos(current_posx, current_posy);

		m_flAccumulatedMouseXMovement += current_posx - x;
		m_flAccumulatedMouseYMovement += current_posy - y;

		// force the mouse to the center, so there's room to move
		ResetMouse();
	}
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:34,代码来源:in_mouse.cpp


注:本文中的GetMousePos函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。