You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The basic behaviour of the GuiButton works as follow:
Firstly we check if the element is interactable (enabled, player isn't currently using sliders);
Then we get the current mouse position and check if it's on the button's body;
Lastly we wait until the key is released on the button's body.
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.
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:
Two new globals have been added to raygui that could be used to address this kind of issues:
staticboolguiControlExclusiveMode= false; // Gui control exclusive mode (no inputs processed except current control)staticRectangleguiControlExclusiveRec= { 0 }; // Gui control exclusive bounds rectangle, used as an unique identifier
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: