Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native support for glfw cursors #28

Open
Frostman opened this issue May 28, 2017 · 5 comments
Open

Native support for glfw cursors #28

Frostman opened this issue May 28, 2017 · 5 comments

Comments

@Frostman
Copy link

Frostman commented May 28, 2017

I see that only cursor hiding is currently supported, what do you think about adding support for the standard glfw cursors like hand and crosshair (http://www.glfw.org/docs/latest/group__shapes.html)?

I've already looked a bit on the way how it works and I can try to implement and make pull request if you're interested in a such small feature.

I'd say that it could be done by defining enum of cursor types in pixelgl/window.go and func (w *Window) SetCursorType(type CursorType).

Thanks.

@faiface
Copy link
Owner

faiface commented May 28, 2017

Hi, thanks for the initiative!

I've been thinking about it in the past and concluded, that these cursors are mainly a feature for GUI applications that want to integrate well with the system. There are of pretty much zero use in games. (In a game, you just hide the cursor and draw your own sprite at the position of the mouse.)

So, I am not for adding this feature now, but let's keep this issue open and see if anybody misses this feature.

If anyone would like this feature implemented, smack a like!

@Frostman
Copy link
Author

@faiface yeah, you're right about standard cursors. Another option is to support setting picture for the cursor. I could be wrong, but I think that if we'll pass image to glfw directly, it'll work much faster than if we just render cursor each time by ourselves.

https://github.com/go-gl/glfw/blob/master/v3.2/glfw/input.go

func CreateCursor(img image.Image, xhot, yhot int) *Cursor {

and

func (w *Window) SetCursor(c *Cursor) {

@silbinarywolf
Copy link

My use case for this feature would be switching to "editing" mode for an integrated level editor and seeing the native cursor would be a nice-to-have.

@unreadable
Copy link

+1 for this implementation, this library should become a GUI one as well. Go doesn't really provide a good gui library... why not extend this on to do both! This way the popularity of the package will increase and so the support for it ;)

@ysmolski
Copy link

Having custom cursors is important in 2D games. Even if the author does not see benefit of this, it does not mean that users of the library would not enjoy this feature. And the way Pixel hides glfw window field, there is no way to setup custom cursor directly via glfw. So the only way is to fork Pixel and add additional code to the lib.

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

No branches or pull requests

5 participants