Skip to content

Add function to disable cursor #803

Open

Description

@Noofbiz

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.

Activity

  1. brunoga commented on Jun 24, 2024

    @brunoga

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions