-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
GuiButton()
not considering mouse state as exclusive mode
#379
Comments
Two new globals have been added to raygui that could be used to address this kind of issues: static bool guiControlExclusiveMode = false; // Gui control exclusive mode (no inputs processed except current control)
static Rectangle guiControlExclusiveRec = { 0 }; // Gui control exclusive bounds rectangle, used as an unique identifier This issue is probably also related to #339 |
Yes, indeed they're related |
raysan5
changed the title
Weird problem with
May 7, 2024
GuiButton
GuiButton()
not considering mouse state as exclusive mode
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The basic behaviour of the
GuiButton
works as follow:There is a problem with the last point though. It seems that the button only check if the mouse key is released on the button's body. What happen is that if we press the mouse button before we position it on the widget, then we move to the button, and at the end we release the mouse input, the button gets selected.
2024-02-08.20-26-59.mp4
Worth mentioning is that the behaviour that prevents the inputing while the slider is held:
if ((state != STATE_DISABLED) && !guiLocked && !guiSliderDragging)
...work fine.
2024-02-08.20-31-36.mp4
Code from the example:
It can be quite problematic, for example: in my game I use state machine for the current state of the game. When we move further in it (or pause) the state is switched, and if the mouse was pressed at that moment and it was positioned when the button will be rendered, when we release the mouse the button gets selected by accident, causing some problems (resuming the game, quitting etc.)
The problem occurs in the latest raylib's and raygui's branch versions. Tested on the Linux platform. If needed, I can provide more info about the situation on Windows.
The text was updated successfully, but these errors were encountered: