예제 #1
0
파일: CCEGLView.cpp 프로젝트: Gamex/GameX
extern "C" void motionCB(int x, int y)
{
    float fx = x;
    float fy = y;
    EGLView* pEGLView = EGLView::getInstance();
    int id = 0;

    if(buttonDepressed)
    {
        pEGLView->handleTouchesMove(1, &id, &fx, &fy);
    }
}
예제 #2
0
파일: CCEGLView.cpp 프로젝트: Gamex/GameX
void EGLViewEventHandler::OnGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y)
{
    s_mouseX = (float)x;
    s_mouseY = (float)y;
    EGLView* eglView = EGLView::getInstance();
    if(nullptr == eglView) return;
    
    s_mouseX /= eglView->getFrameZoomFactor();
    s_mouseY /= eglView->getFrameZoomFactor();
    
    if(s_captured)
    {
        if (eglView->getViewPortRect().equals(Rect::ZERO) || eglView->getViewPortRect().containsPoint(Point(s_mouseX,eglView->getFrameSize().height - s_mouseY)))
        {
            int id = 0;
            eglView->handleTouchesMove(1, &id, &s_mouseX, &s_mouseY);
        }
    }
}