engo
engo copied to clipboard
Add function to disable cursor
For things like First-Person games, the cursor should be locked to the window, so moving too far left or right out of the window doesn't stop the gameplay.
I assume you are talking about desktop, right? FWIIW, I accomplished this by doing this (I do have a "game" using engo that requires the behavior you describe):
// Disable cursor.
if engo.CurrentBackEnd == engo.BackEndGLFW ||
engo.CurrentBackEnd == engo.BackEndVulkan {
glfw.GetCurrentContext().SetInputMode(glfw.CursorMode,
glfw.CursorDisabled)
} else {
panic("Backend does not seem to support mouse capture.")
}
https://github.com/brunoga/robomaster-control/blob/c6764bc8fee10ad3c8fa50899809f175ad0c068a/scenes/robomaster.go#L59