g3n / engine

Go 3D Game Engine (http://g3n.rocks)
https://discord.gg/NfaeVr8zDg
BSD 2-Clause "Simplified" License
2.74k stars 292 forks source link

Added DisabledCursor and HiddenCursor as cursor types #267

Closed bendgk closed 2 years ago

bendgk commented 2 years ago

Implemented GLFW_CURSOR_DISABLED and GLFW_CURSOR_HIDDEN as per the glfw (input mode)[https://www.glfw.org/docs/3.3/input_guide.html#cursor_mode] specifications.

Created two new cursor types:

Example:

DisabledCursor

app.SetCursor(window.DisabledCursor)

HiddenCursor

app.SetCursor(window.HiddenCursor)

This will allow people to use g3n to create games or other interactive applications that require mouse capture.

danaugrs commented 2 years ago

@bendgk Thanks for the PR!

You can use:

myGlfwWindow.SetInputMode(glfw.CursorMode, glfw.CursorHidden)

If you are using engine/app then you can do:

a.IWindow.(*window.GlfwWindow).SetInputMode(glfw.CursorMode, glfw.CursorHidden)

where a is an Application instance.

You can directly use any glfw method you want since GlfwWindow embeds a *glfw.Window