A single header file implementation of backend implementation of simple dynamic split based panel system in c.
- Create a split based resizable panel system.
- Panel attributes shares memory address for same properties. So, modify any panel and it will adjust others.
Creates a panel from given points.
Input:
Point origin: Coordinates of top left corner of panel.
Point end: Coordinates of bottom right corner of panel.
Output:
Returns an instance of struct panel.
Splits a Panel vertically or horizontally and return new Panel formed.
New panel is formed on right of given panel for horizontal split and on
bottom for given panel for vertical split.
Input:
Panel *panel: pointer to Panel to split.
enum PanelSplitType splitType: Direction of split.
Choose from PANEL_SPLIT_TYPE_VERTICAL and PANEL_SPLIT_TYPE_HORIZONTAL
Output:
Returns an instance of struct Panel.
- Include the
split_panel.hfile in your code. - Initialize the panel using folowing code.
Point origin = CreatePoint(0.0f, 0.0f); // Top left corner
Point end = CreatePoint(100.0f, 100.0f); // Top right corner
// Create panel
Panel basePanel = CreatePanel(origin, end)- To Split the panel use
SplitPanel()function.
// Split panel vertically
Panel newPanel = SplitPanel(&basePanel, PANEL_SPLIT_TYPE_VERTICAL);
// Split panel horizontally
Panel newPanel = SplitPanel(&basePanel, PANEL_SPLIT_TYPE_HORIZONTAL);- To modify the split simply modify any point of any panel.
// Modify origin's 'x' of 'basePanel'.
*basePanel.origin.x = 10.0f;
// Other panels also get the changes as common ordinates share address.
printf("%f", *newPanel.origin.x); // 10.0fGUI simple example using raygui
GUI example better using raygui
- Remove as much pointer usage as possible.
- Add ability to remove panel.
- Add more descreptive split types. Ex:
SPLIT_LEFT,SPLIT_RIGHT,SPLIT_TOPandSPLIT_BOTTOM. - Add Pool system to take load of memory managment from user.
- Add docking(pulling out panel).
Enjoy panelling

