本文整理汇总了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);
}
}
}
示例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;
}
}
示例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;
}