Exemple #1
0
	bool OpenGLWindow::MouseEvent(double x, double y)
	{
        bool inWindow = BaseWindow::MouseEvent(x, y);
		int state = glfwGetMouseButton(m_window, GLFW_MOUSE_BUTTON_LEFT);
        if(inWindow && state == GLFW_PRESS)
        {
            if(m_isFirstMouse)
            {
                m_isFirstMouse = false;
            }
            else
            {
                Camera* mainCamera = m_renderMgr->GetCamera();
                
                double offsetx = x - m_lastMouseX;
				double offsety = y - m_lastMouseY;
                
                offsetx *= Global::mouseSensitivity;
                offsety *= Global::mouseSensitivity;

                mainCamera->AddRotation(offsetx, offsety, 0.0f);
            }
            
            m_lastMouseY = y;
            m_lastMouseX = x;
        }
        return inWindow;
	}