raysan5 / raygui

A simple and easy-to-use immediate-mode gui library
zlib License
3.36k stars 289 forks source link

`GuiScrollPanel()` improvement #341

Closed danielchasehooper closed 7 months ago

danielchasehooper commented 11 months ago

GuiScrollPanel is kind of annoying to use right now because it requires you to set up the scissor and offset all the controls that should be drawn inside it. The api could be improved if it instead worked like so:

// this draws the panel, sets up the scissor, calls rlPushMatrix and rlTranslatef
GuiBeginScrollPanel(scroll_panel_bounds, "title", content_size); 
    // draw everything you want in the scroll panel
GuiEndScrollPanel(); // restores scissor and pops the matrix
raysan5 commented 11 months ago

I tried to minimize raylib-dependencies and OpenGL functions inside raygui, to make it standalone overwriting some "simple" functions, for that reason clipping is moved to user side. Also raygui does not use the Begin/End approach for now but I considered a similar approach for auto-layout placement... for the moment it's on the user-side...