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

Define a consistent convention on controls return values #402

Open
raysan5 opened this issue May 7, 2024 · 0 comments
Open

Define a consistent convention on controls return values #402

raysan5 opened this issue May 7, 2024 · 0 comments

Comments

@raysan5
Copy link
Owner

raysan5 commented May 7, 2024

raygui was redesigned on v4.0 to always return an int as "control result value" while keeping the control required variables as function parameters, usually passed by reference.

Despite the redesign, there was no rule defining/unifying that "control result value" that should be returned by every control. Here some possible ideas (ref: #371):

typedef enum GuiControlResult {
    RESULT_NONE = 0,
    RESULT_FOCUSED = 1,
    RESULT_CLICKED = 2,
    RESULT_SCROLLED = 3,
    RESULT_CUSTOM01 = 4,
    RESULT_CUSTOM02 = 5,
} GuiControlResult;

Every control has to be carefully analized to see what are the possible internal states that could be returned. It would be nice to unify the possible return values but also allow per-control custom return values.

Note that some controls already return specific results, reviewing this functionality could be a breaking change:

  • GuiButton(): Returns 1 when clicked --> RESULT_CLICKED?
  • GuiTextBox(): Returns true when edited, used to change editMode
  • ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant