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


C++ SimpleGUI::UpdateMouse方法代码示例

本文整理汇总了C++中SimpleGUI::UpdateMouse方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleGUI::UpdateMouse方法的具体用法?C++ SimpleGUI::UpdateMouse怎么用?C++ SimpleGUI::UpdateMouse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleGUI的用法示例。


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

示例1: DefWindowProc

LRESULT CALLBACK
WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	POINT mousePos;
	int dx = 0;
	int dy = 0;

	switch( msg )
	{
	case WM_LBUTTONDOWN:
		if( wParam & MK_LBUTTON )
		{
			SetCapture(hwnd);

			mOldMousePos.x = ( short )LOWORD(lParam);
			mOldMousePos.y = ( short )HIWORD(lParam);
			gui.UpdateMouse(mOldMousePos.x,mOldMousePos.y,true);
		}
		return 0;

	case WM_LBUTTONUP:
		ReleaseCapture();
		return 0;

	case WM_RBUTTONDOWN:
		if( wParam & MK_RBUTTON )
		{
			SetCapture(hwnd);

			mOldMousePos.x = ( short )LOWORD(lParam);
			mOldMousePos.y = ( short )HIWORD(lParam);
			POINT d;
			d.x = ( short )LOWORD(lParam);
			d.y = ( short )HIWORD(lParam);
			//qtc.TEST(vp, d, qtc.getBLS(), 5, md3dDevice);
			if(gui.GetButton(PLACE_TOWER)->GetPressed())
			{
				D3DXVECTOR3 res = qtc.PlaceATower(vp, d);
				if (res != D3DXVECTOR3(-99,-99,-99))
				{
					mTowers.push_back(Tower());
					mTowers.back().init(md3dDevice, D3DXVECTOR3(7.5f, 7.5f, 7.5f), res);
					newCube = true;
					nrOfTowers.resize(mTowers.size());
					currentTower = (int)nrOfTowers.size()-1;
					gui.GetButton(PLACE_TOWER)->SetPressed(false);
				}
			}
			//cam.setLens(0.30f*(gameTime.getDeltaTime()*20), (float)SCREEN_WIDTH/SCREEN_HEIGHT, 1.0f, 1000.0f);
		}
		return 0;

	case WM_RBUTTONUP:
		GetCamera().setLens(0.30f*pi, (float)SCREEN_WIDTH/SCREEN_HEIGHT, 1.0f, 1000.0f);
		ReleaseCapture();
		return 0;

	case WM_MOUSEMOVE:
		if( wParam & MK_LBUTTON || wParam & MK_RBUTTON )
		{
			mousePos.x = ( short )LOWORD(lParam);
			mousePos.y = ( short )HIWORD(lParam);

			dx = mousePos.x - mOldMousePos.x;
			dy = mousePos.y - mOldMousePos.y;

			GetCamera().rotateY( dx * 0.0087266f );
			GetCamera().pitch( dy * 0.0087266f );

			mOldMousePos = mousePos;
		}
		return 0;

	case WM_KEYDOWN:
		if(wParam == VK_CONTROL) GetCamera().crouch();
		if(wParam == VK_SPACE)	
		{
			if (!jumping)
				GetCamera().setJump(GetTime().getGameTime());
			jumping = true;
		}
		if (GetAsyncKeyState('F') & 0x8000)
		{
			if (funRot)
				funRot = false;
			else
				funRot = true;
		}
		if (GetAsyncKeyState('R') & 0x8000)
		{
			if (grid)
				grid = false;
			else
				grid = true;
		}
		if (GetAsyncKeyState('O') & 0x8000)
		{
			if(!newCube)
			{
				Tower c;
//.........这里部分代码省略.........
开发者ID:GameProject,项目名称:Tower,代码行数:101,代码来源:Winmain.cpp


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