Jump to content

View more

Image of the Day

Working on an auto spawn system. #gamedev #indiedev #screenshotsaturday https://t.co/Mm2kfekz7b
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

[GLFW] Mouse (sometimes) disappears after window resize/detecting mouse tap

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 Zotoaster   Members   

148
Like
0Likes
Like

Posted 29 October 2013 - 09:47 AM

Hey, I'm making a 2d editor with my own GUI system and it's working quite well. I'm having a problem however with the mouse occasionally disappearing after resizing or maximizing the window. I'm using OS X 10.7.3 with GLFW3.

 

Here's the code for my main loop in case that helps. Keep in mind I'm new to OpenGL so I'm not sure if it's a problem with my code or a bug. All I know is that sometimes I'll resize and I can still see the mouse, other times it'll disappear.

        while (!glfwWindowShouldClose(_window))
        {
            int width, height;
            glfwGetFramebufferSize(_window, &width, &height);
            
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
            glMatrixMode (GL_PROJECTION);
            glLoadIdentity ();
            glOrtho (0, width, height, 0, 0, 1);
            glViewport(0, 0, width, height);
            glDisable(GL_DEPTH_TEST);
            glMatrixMode (GL_MODELVIEW);            
            glLoadIdentity();
            
            double mx, my;
            glfwGetCursorPos(_window, &mx, &my);
            
            gui::GUIEnv::Instance()->_mouseX = (int)mx;
            gui::GUIEnv::Instance()->_mouseY = (int)my;
            
            Update();
            
            glfwSwapBuffers(_window);
            glfwPollEvents();
        }

Another question I'd like to ask. I'm using a MacBook and although I can detect mouse clicks, I have to either push down on the trackpad or double tap it to register a mouse click. Is there a way to detect a single mouse tap and register as a click?

Thanks



#2 Aliii   Members   

1456
Like
0Likes
Like

Posted 29 October 2013 - 10:38 AM

I dont know if this thing is a bug or not ....but I used glfw a year ago and it did have a lot of bugs.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.