engo icon indicating copy to clipboard operation
engo copied to clipboard

Add function to disable cursor

Open Noofbiz opened this issue 1 year ago • 1 comments

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.

Noofbiz avatar Dec 14 '23 20:12 Noofbiz

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

brunoga avatar Jun 24 '24 14:06 brunoga