コード例 #1
0
void mouseButton(GLFWwindow * window, int button, int action, int mods) {
    
    if(!TwEventMouseButtonGLFW(button, action)) {

        if(button != GLFW_MOUSE_BUTTON_LEFT)
            return;

        switch(action) {

            case GLFW_PRESS:

                double x, y;
                glfwGetCursorPos(window, &x, &y);
                scene->mousePress(x, y);
                break;

            case GLFW_RELEASE:

                scene->mouseRelease();
                
                break;

            default:
                
                break;
        }
    }
}
コード例 #2
0
ファイル: GLFW_App.cpp プロジェクト: mojovski/KinskiGL
 void GLFW_App::s_mouseButton(GLFWwindow* window,int button, int action, int modifier_mask)
 {
     GLFW_App* app = static_cast<GLFW_App*>(glfwGetWindowUserPointer(window));
     if(app->displayTweakBar())
         TwEventMouseButtonGLFW(button, action);
     
     uint32_t initiator, keyModifiers, bothMods;
     s_getModifiers(window, initiator, keyModifiers);
     bothMods = initiator | keyModifiers;
     
     double posX, posY;
     glfwGetCursorPos(window, &posX, &posY);
     
     MouseEvent e(initiator, (int)posX, (int)posY, bothMods, glm::ivec2(0));
     
     switch(action)
     {
         case GLFW_PRESS:
             app->mousePress(e);
             break;
             
         case GLFW_RELEASE:
             app->mouseRelease(e);
             break;
     }
 }
コード例 #3
0
ファイル: TwAdvanced1.cpp プロジェクト: davidcox/AntTweakBar
// Callback function called by GLFW when a mouse button is clicked
void GLFWCALL OnMouseButton(int glfwButton, int glfwAction)
{
    if( !TwEventMouseButtonGLFW(glfwButton, glfwAction) )   // Send event to AntTweakBar
    {
        // Event has not been handled by AntTweakBar
        // Do something if needed.
    }
}
コード例 #4
0
ファイル: glfw_main.cpp プロジェクト: SantanMaddi/RiftRay
void mouseDown_Aux(GLFWwindow* pWindow, int button, int action, int mods)
{
    (void)pWindow;
    (void)mods;

#ifdef USE_ANTTWEAKBAR
    int ant = TwEventMouseButtonGLFW(button, action);
    if (ant != 0)
        return;
#endif
    mouseDown(pWindow, button, action, mods);
}
コード例 #5
0
ファイル: part1.cpp プロジェクト: krewie/toonshading
void mouseButtonCallback(GLFWwindow* window, int button, int action, int mods)
{
    double x, y;
    glfwGetCursorPos(window, &x, &y);
    if(!TwEventMouseButtonGLFW(button, action)){
      if (action == GLFW_PRESS) {
          mouseButtonPressed(button, x, y);
      }
      else {
          mouseButtonReleased(button, x, y);
      }
  }
}
コード例 #6
0
ファイル: controls.cpp プロジェクト: lejar/CustomViewer
void GLFWCALL OnMouseButton(int glfwButton, int glfwAction)
{
	//if(!prevrMouseDown)
    {
	    if( !TwEventMouseButtonGLFW(glfwButton, glfwAction) )   // Send event to AntTweakBar
	    {
	    	GUIactive = false;
	        // Event has not been handled by AntTweakBar
	        // Do something if needed.
	    }
	    else
	    	GUIactive = true;
	}
}
void mouseButton(GLFWwindow* window, int button, int action, int mods){
	if (TwEventMouseButtonGLFW(button, action))
		return;

	double x, y;
	glfwGetCursorPos(gpWindow, &x, &y);
	float ax = x;
	float ay = gHeight - y;

	if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS){
		gpCamera->setLeftButtonPress(true, x,y);
		processSelection(x, y);
	}

	if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_RELEASE){
		gpCamera->setLeftButtonPress(false, x, y);
	}
}
コード例 #8
0
static void onMouseDown(GLFWwindow* window, int button, int action, int mods)
{
	// AntTweakBar event
	if (TwEventMouseButtonGLFW(button, action))
		return;

	// Scroll wheel press
	if (button == GLFW_MOUSE_BUTTON_1){
		if (action == GLFW_PRESS){
			s_camera.setMode(glfwGetKey(window, GLFW_KEY_LEFT_ALT) == 
				GLFW_PRESS ? CameraMode::ARC : CameraMode::PAN);
		}
		else if (action == GLFW_RELEASE){
			s_camera.setMode(CameraMode::NONE);
		}
	}

	// Generate selection ray
	if (button == GLFW_MOUSE_BUTTON_2){
		if (action == GLFW_PRESS){
			// Get mouse pos
			double mouse_x, mouse_y;
			glfwGetCursorPos(window, &mouse_x, &mouse_y);
			// Calc selection ray
			int screenWidth, screenHeight;
			glfwGetWindowSize(window, &screenWidth, &screenHeight);
			double x = (2.0f * mouse_x) / double(screenWidth) - 1.0f;
			double y = 1.0f - (2.0f * mouse_y) / double(screenHeight);
			glm::vec4 ray_clip = glm::vec4(x, y, -1.0, 1.0);
			glm::vec4 ray_eye = glm::inverse(s_proj) * ray_clip;
			ray_eye = glm::vec4(ray_eye.x, ray_eye.y, -1.0, 0.0);
			glm::vec3 ray_wor = glm::normalize(glm::vec3(inverse(s_camera.getView()) * ray_eye));
			// Ray cast event
			rayCast(ray_wor);
		}
		else if (action == GLFW_RELEASE) {
			delete g_drag;
			g_drag = NULL;
		}
	}
}
コード例 #9
0
ファイル: overlay.cpp プロジェクト: dsmo7206/genesis
// Wrapper functions for tweak bar - tweak bar expects GLFW(<3) format callbacks
void myTwEventMouseButtonGLFW(GLFWwindow* window, int button, int action, int mods)
{
	TwEventMouseButtonGLFW(button, action);
}
コード例 #10
0
	void DebugUIMousePress(int button, int state)
	{
		TwEventMouseButtonGLFW(button, state);
	}
コード例 #11
0
ファイル: App.cpp プロジェクト: jaccen/OpenGL-Framework
void App::glfw_mouseButton(GLFWwindow *window, int x, int y, int z)
{
	TwEventMouseButtonGLFW(x, y);
}
コード例 #12
0
bool Sample::mouse_button(int button, int action)
{
  return !!TwEventMouseButtonGLFW(button, action);
}
コード例 #13
0
ファイル: main.cpp プロジェクト: stevenblaster/craplib
void gui_mouse_up( i32 key )
{
	TwEventMouseButtonGLFW( key, 0 );
}
コード例 #14
0
ファイル: main.cpp プロジェクト: stevenblaster/craplib
void gui_mouse_down( i32 key )
{
	TwEventMouseButtonGLFW( key, 1 );
}
コード例 #15
0
ファイル: TwEventGLFW.c プロジェクト: mojovski/KinskiGL
// functions with __cdecl calling convension
TW_API int TW_CDECL_CALL TwEventMouseButtonGLFWcdecl(int glfwButton, int glfwAction)
{
    return TwEventMouseButtonGLFW(glfwButton, glfwAction);
}
コード例 #16
0
void GLFWCALL mouseButtonListener(int a, int b)
{
	TwEventMouseButtonGLFW(a,b);
}
コード例 #17
0
ファイル: oglApp.cpp プロジェクト: byhj/byhj-Render
	void OGLApp::glfw_mouseButton(GLFWwindow *window, int x, int y, int z)
	{
		//OGLSphereCamera::getInstance()->mouseButton_callback(window, x, y, z);
		TwEventMouseButtonGLFW(x, y);
	}
コード例 #18
0
ファイル: GameEngineC.cpp プロジェクト: Cethric/GameEngineC
void mouseButtonCallback(GLFWwindow *window, int button, int action, int mods) {
    int tweak = TwEventMouseButtonGLFW(button, action);
}