• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetMousePos函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: SetCapture

void SplitterFrame::LeftDown(Point p, dword)
{
	SetCapture();
	Refresh();
	ref = GetMousePos();
	size0 = BoundSize();
}
开发者ID:pedia,项目名称:raidget,代码行数:7,代码来源:FrameSplitter.cpp


示例17: GuiPlatformGripResize

void GuiPlatformGripResize(TopWindow *q)
{
	if(q->top) {
		Point p = GetMousePos();
		gtk_window_begin_resize_drag(q->gtk(), GDK_WINDOW_EDGE_SOUTH_EAST,
		                             1, p.x, p.y, Ctrl::CurrentTime);
	}
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:8,代码来源:GtkCtrl.cpp


示例18: GetMousePos

int GLWindow::GetMouseX()
{
	if (MousePos.x==0)
		GetMousePos();
	int back=MousePos.x;
	MousePos.x=0;
	return back;	
}
开发者ID:ldornbusch,项目名称:hexxagon_sfml,代码行数:8,代码来源:GLWindow.cpp


示例19: GetMousePos

void LineEdit::MouseMove(Point p, dword flags) {
	if((flags & K_MOUSELEFT) && HasFocus() && HasCapture()) {
		int c = GetMousePos(p);
		dorectsel = flags & K_ALT;
		PlaceCaret(c, mpos != c || HasCapture());
		dorectsel = false;
	}
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:8,代码来源:LineEdit.cpp


示例20: AutoScroll

// Get current mouse position.  If the mouse is above/below the current
// window then scroll the window down/up proportionally to the time the LMB
// is held down.  This function is called from autoscroll_thread() when the
// mouse is captured and a wipe selection is active.
static void
AutoScroll(WINDOW *wp)
{
#define DVSR    10
#define INCR    6
#define TRIGGER (DVSR + INCR)

    POINT current;
    int Scroll = 0;
    static int ScrollCount = 0, Throttle = INCR;

    GetMousePos(&current);

    if (wp == 0)
	return;

    // Determine if we are above or below the window,
    // and if so, how far...
    if (current.y < wp->w_toprow) {
	// Above the window
	// Scroll = wp->w_toprow - current.y;
	Scroll = 1;
    }
    if (current.y > mode_row(wp)) {
	// Below
	// Scroll = current.y - mode_row(wp);
	// Scroll *= -1;
	Scroll = -1;
    }
    if (Scroll) {
	int row;
	if (Scroll > 0) {
	    row = wp->w_toprow;
	} else {
	    row = mode_row(wp) - 1;
	}

	// Scroll the pre-determined amount, ensuring at least one line of
	// window movement per timer tick.  Note also that ScrollScale is
	// signed, so it will be negative if we want to scroll down.
	mvupwind(TRUE, Scroll * max(ScrollCount, TRIGGER) / (Throttle + DVSR));

	// Set the cursor. Column doesn't really matter, it will
	// get updated as soon as we get back into the window...
	setcursor(row, 0) && sel_extend(TRUE, TRUE);
	(void) update(TRUE);
	ScrollCount++;
	if (ScrollCount > TRIGGER && Throttle > 0 && ScrollCount % INCR == 0)
	    Throttle--;
    } else {
	// Reset counters
	Throttle = INCR;
	ScrollCount = 0;
    }
#undef DVSR
#undef INCR
#undef TRIGGER
}
开发者ID:OS2World,项目名称:APP-EDITOR-Vile,代码行数:62,代码来源:ntconio.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetMover函数代码示例发布时间:2022-05-30
下一篇:
C++ GetMouse函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap