Closed zeozeozeo closed 2 weeks ago
Interesting, I never saw for (enum ...
:)
I'll let the CI complete and if everything is green I'll merge the PR (and will probably also update one of the sokol-samples to enable mouse cursors).
Btw, I seem to remember that there was a specific reason that I'm initializing the mouse cursor before the switch with the currently active mouse cursor instead of SAPP_MOUSECURSOR_ARROW
, I just don't remember what that specific situation was:
(if your code somehow triggers that problem then we can still fix it in a separate PR I guess)
Hmm, somehow I hadn't noticed that the Nuklear software mouse cursor is now always active... that definitely wasn't intended... (meaning that the Nuklear mouse cursor is always active since this PR was merged: https://github.com/floooh/sokol/pull/1138)
Hmm, somehow I hadn't noticed that the Nuklear software mouse cursor is now always active... that definitely wasn't intended...
Yeah, apparently nk_style_load_all_cursors()
will always enable the software cursor. Maybe this option should be changed to disable_set_mouse_cursor
, and disable loading cursors when it is not enabled?
I think I will just modify your code to work the same as sokol_imgui.h: rename the flag to disable...
and by default use the sokol_app.h mouse cursor functions, and otherwise use the Nuklear builtin mouse cursors.
PS: I will add two flags: disable_set_mouse_cursor
(which works the same as sokol_imgui.h) and enable_software_mouse_cursor
(which loads the software mouse cursor images).
Hmm ok, not so simple, looks like calling nk_style_load_all_cursors()
is what activates the cursor handling in the first place.
...I think I'll go with your original code :)
Ok, one change I'll do after playing around with it: I'll move the code from the event handler to the start of the snk_render() function. Otherwise the mouse pointer gets stuck at the end of an operation until it is moved again.
Ooof I broke it :D (forgot about the SOKOL_NUKLEAR_NO_SOKOL_APP
define, will fix that on main)
Ok, all green now. Thanks for the PR!
Ok, the two nuklear sokol-samples now use your code:
nice :shipit:
Add an option
enable_set_mouse_cursor
to enable setting OS mouse cursors withsapp_set_mouse_cursor
. By default Nuklear draws its' own custom cursor.It is the opposite of
disable_set_mouse_cursor
in sokol_imgui.h, to not break existing apps.Currently this option doesn't actually disable loading the custom cursor icons, and still requires you to call
nk_style_hide_cursor()
to hide Nuklear's cursor.