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

Recap on the latest raygui changes #29

Closed
raysan5 opened this issue Feb 14, 2019 · 4 comments
Closed

Recap on the latest raygui changes #29

raysan5 opened this issue Feb 14, 2019 · 4 comments

Comments

@raysan5
Copy link
Owner

raysan5 commented Feb 14, 2019

In the past weeks raylib has changed a lot, just open this issue to recap all library changes and open possible discussion points on library improvements.

  • Support rIcons, a custom set of simple pixelart icons: Now all text placed in any raygui control can be prefixed with a custom icon just defining its id number (#027#). This improves a lot raylib visuals for tools development.
  • Support text alignment for every control: Now text alignment for the control can be defined as a new style property TEXT_ALIGNMENT. Text alignment also considers rIcons.
  • Greatly simplified controls drawing code: Most of the drawing code for every control state was the same, the only change was control color, so, drawing has been simplified by directly choosing drawing color in function of state. More than 400 code lines have been removed.
  • Some controls have been redesigned to avoid styling parameters passed directly to the function (Decouple controls styling from control function #22).
  • Added GuiScrollBar() and implemented it in GuiScrollPanel() and GuiListView(). Thanks to @Demizdor for his work on this improvement.

During this big changes process, some issues have been detected and some questions arise:

  1. GuiImageButton(), do we really need this function? It could seem to be useful but it adds additional dependencies to textures drawing... actually, I never used it. Now with the rIcons addition maybe it could be removed.
    SOL: Keep it for the moment.

  2. GuiCheckBox(), how text alignment support should be applied to this specific control? Now text is just drawn after the control.
    SOL: Use text alignment to place text to left or right of the control.

  3. GuiSlider(), GuiSliderBar(), GuiProgressBar(), On this controls, text is not part of the control bounds, it's just appended before or after the control; how text alignment should work? Also, what about the infamous showValue parameter? I don't like it, it neither gives margin for value formating... Those functions could require some redesign.
    SOL: Functions redesignedm showValue removed, added two text parameter to functions for custom left and right control text.

  4. GuiTextBox(), GuiTextBoxMulti(), those ones need some improvements, as stated in issue GuiTextBoxMulti() missing features #24. Probably they can use directly the new text-rectangle-drawing functionality available on raylib.
    SOL: GuiTextBoxMulti() now uses DrawTextRec().

  5. GuiValueBox(), GuiSpinner(), maybe those functions could use directly GuiTextBox() or some base function common to all text-drawing-in-rectangle functions.
    SOL: They already use GuiTextBox().

  6. GuiListViewEx(), it depends on GuiListElement() and it's ugly... maybe it should be redesigned... Seem quite difficult to accomodate all control possibilities.
    SOL: GuiListElement() has been removed, GuiListViewEx() and GuiComboBox() have been redesigned from scratch.

Those are just some points, I'll update this list as required...

Also, if someone is working/testing/playing with raygui, feedback is very welcomed.

@Demizdor
Copy link
Contributor

Demizdor commented Feb 15, 2019

Hi @raysan5, here are my thoughts on this

  • Maybe i'm missing something about rIcons but i don't see the usefulness of the current implementation ...what is the goal here? to have icons drawn before or after the text?.. if that is the case then why not allow the user to pass a texture to a control maybe with array of rects for multiple icons !? Or why not implement a better UTF8 support and inject the rIcons as codepoints into the PUA or allow the user to inject own icons in there?
    Now please don't take this the wrong way, i'm not trying to discredit your work, you worked hard on these and it shows, the icons are all lovely ❤️
    Like i said maybe i'm missing something!

  • TEXT_ALIGNMENT is very useful i think

  • removing GuiImageButton() will be a bad idea in my oppinion...how else to add your own icon to a button.. this will limit the user solely to the icons provided by rIcons.

  • GuiTextBox(), GuiTextBoxMulti() made some progress, implemented caret positioning in GuiTextBox() ...lack of free time means this will take some time sorry!
    caret_pos_test

  • GuiListViewEx() i'm still confident that using scissor area is the best solution for this.. i mean we can be smart about it and don't draw all the elements just the elements that need to be drawn those between startIndex and endIndex as they are named in current implementation.

@raysan5
Copy link
Owner Author

raysan5 commented Feb 15, 2019

Hi @Demizdor!

Actually, rIcons is the result of a personal need, as you probably know, I'm working in the development of a small set of tools (rFXGen is one of them) and after doing some tests, I realized that, adding some icons to the controls improved a lot the visual style. I also wanted a custom and personal style for those icons (following raylib/raygui minimalist style), so, I created the rIcons. Benefits of rIcons for raygui in comparison to other options:

  • rIcons follow raylib/raygui minimalist style, allowing out-of-the-box creation of similar style tools.
  • rIcons provide a quite complete set of icons, when designing tools, it could be difficult to find all the icons you need with the same style/size and most of the time selecting those icons, organizing them, catalogue them, rename, copying, loading files is a complete nightmare.
  • rIcons is embedded with raygui, no external dependencies required, all icons are compiled with the user tool and memory footprint is really low.
  • rIcons only require a DrawRectangle() function (or DrawPixel() or similar) to be drawn, no image/texture loading/unloading required, neither graphic context management, it makes the library extremely portable to any engine (almost drag & drop).
  • Current implementation do not require any additional parameter to any existing control (I always try to keep function parameters low, as much as possible). Icons can be just created with a small icon code along the text, it's really comfortable.
  • GuiImageButton() allows passing a Texture2D and a rectangle but this implementation is not really portable, it's quite dependant on the engine/framework used and it also requires longer function with extra parameter just for one type of control. Adapting that same behaviour to all controls will require a complete redesign... rIcons solves that.

Also, current implementation could be extended to support icons as codepoints (requiring a font including those icons) and also allowing users to create they own rIcons, a tool is already being designed.

@Demizdor
Copy link
Contributor

Hey, thanks for writing such a detailed response, i appreciate it. Seems you thought very hard about all of this.

Good job!

@raysan5
Copy link
Owner Author

raysan5 commented Aug 25, 2019

Added SOL notes on the main description.

@raysan5 raysan5 closed this as completed Aug 25, 2019
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

2 participants