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


C++ CCEGLView::handleTouchesEnd方法代码示例

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


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

示例1: mouseButtonEventHandle

void mouseButtonEventHandle(int iMouseID,int iMouseState) {
	if (iMouseID == GLFW_MOUSE_BUTTON_LEFT) {
        CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
		//get current mouse pos
		int x,y;
		glfwGetMousePos(&x, &y);
		DPoint oPoint((float)x,(float)y);
		/*
		if (!CCRect::CCRectContainsPoint(s_pMainWindow->m_rcViewPort,oPoint))
		{
			CCLOG("not in the viewport");
			return;
		}
		*/
         oPoint.x /= pEGLView->m_fFrameZoomFactor;
         oPoint.y /= pEGLView->m_fFrameZoomFactor;
		int id = 0;
		if (iMouseState == GLFW_PRESS) {
			pEGLView->handleTouchesBegin(1, &id, &oPoint.x, &oPoint.y);

		} else if (iMouseState == GLFW_RELEASE) {
			pEGLView->handleTouchesEnd(1, &id, &oPoint.x, &oPoint.y);
		}
	}
}
开发者ID:DreamCastleShanghai,项目名称:dkomClient,代码行数:25,代码来源:CCEGLView.cpp

示例2: if

extern "C" void mouseCB(int button, int state, int x, int y)
{
    float fx = x;
    float fy = y;
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
    int id = 0;

    if(button != glutLeftButton) return;

    if(state == glutMouseDown)
    {
        pEGLView->handleTouchesBegin(1, &id, &fx, &fy);
        buttonDepressed = true;
    }
    else if(state == glutMouseUp)
    {
        pEGLView->handleTouchesEnd(1, &id, &fx, &fy);
        buttonDepressed = false;
    }
}
开发者ID:CocosRobot,项目名称:cocos2d-x,代码行数:20,代码来源:CCEGLView.cpp

示例3: myWndProcHook


//.........这里部分代码省略.........
			case 'S':   //向下
				{
					pt = ccp(62, 290);
				}
				break;
			case 'J':   //攻击
				{
					pt = ccp(367, 277);
				}
				break;
			case 'K':   //跳跃
				{
					pt = ccp(445, 247);
				}
				break;
			default:
				return 0;
			}
			if (GetKeyState('D') & 0x8000)
			{
				if (GetKeyState('W') & 0x8000)      //右上角
				{
					pt = ccp(91, 227);
				}
				else if (GetKeyState('S') & 0x8000) //右下角
				{
					pt = ccp(91, 284);
				}
			}
			else if (GetKeyState('A') & 0x8000)
			{
				if (GetKeyState('W') & 0x8000)      //左上角
				{
					pt = ccp(36, 227);
				}
				else if (GetKeyState('S') & 0x8000) //左下角
				{
					pt = ccp(36, 284);
				}
			}

			CCEGLView* eglView = CCEGLView::sharedOpenGLView();
			CCSize originalDesignResolutionSize = CCSizeMake(480, 320);     //原始的设计分辨率大小
			ResolutionPolicy eResolutionPolicy = kResolutionFixedWidth;     //分辨率策略
			CCSize obDesignResolutionSize = eglView->getDesignResolutionSize();
			int offsetWidth = obDesignResolutionSize.width - originalDesignResolutionSize.width;
			int offsetheight = obDesignResolutionSize.height - originalDesignResolutionSize.height;
			CCSize obScreenSize = eglView->getFrameSize();
			int offsetWidth2 = obScreenSize.width - originalDesignResolutionSize.width;
			int offsetheight2 = obScreenSize.height - originalDesignResolutionSize.height;
			switch (eResolutionPolicy)
			{
			case kResolutionExactFit:
				{
					//...
				}
				break;
			case kResolutionNoBorder:
				{
					//...
				}
				break;
			case kResolutionShowAll:
				{
					pt.x += offsetWidth2 / 2;
					pt.y += offsetheight2 / 2;
				}
				break;
			case kResolutionFixedHeight:
				{
					//...
				}
				break;
			case kResolutionFixedWidth:
				{
					pt.y += offsetheight;
				}
				break;
			}

			pt.x *= eglView->getScaleX();
			pt.y *= eglView->getScaleY();

			int id = wParam;
			if (message == WM_KEYDOWN)
			{
				eglView->handleTouchesBegin(1, &id, &pt.x, &pt.y);
			}
			else
			{
				eglView->handleTouchesEnd(1, &id, &pt.x, &pt.y);
			}

			*pProcessed = TRUE;
		}
		break;
	}

	return 0;
}
开发者ID:jfojfo,项目名称:MyPompaDroid,代码行数:101,代码来源:main.cpp


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