Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - john01dav

Pages: [1]
1
Window / What is SFML's recommended method for a mouse camera with 3D?
« on: November 15, 2017, 03:13:56 am »
Hello,

I recently came across SFML, and it seems like an awesome library, having things like built-in networking and a windowing API that isn't full of boilerplate. I have been using it to attempt to create an opengl-based 3D api that I can then use in my later projects, however, and I've run into one issue: mouse capturing. In this api I want to have the mouse be invisible and inside the window, such that the user can move the mouse to look around, as is common in many games such as most FPSes, Portal, and Minecraft. While looking on the Internet for a solution to this, I found this pull request and the advice to make the mouse invisible and move it to width/2, height/2 when it moves. Using just the pull request causes the mouse to stay within the window, but when it reaches the edge it stops moving thus making it impossible to tell where the user is moving the mouse. When I attempt to move it to setPosition every time sf::Event::MouseMoved is called, this produces extreme lag, with the application freezing for several seconds at a time if the mouse moves a lot in a short time frame (on Ubuntu Linux 17.10 x64). I managed to get something working where I only move the mouse if it gets near the edge of the but that seems very messy, and I am wondering if there is a better way.

Thank you.

Pages: [1]