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
Copy file name to clipboardExpand all lines: README.md
+26-7Lines changed: 26 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,26 +47,45 @@ leanUI provides a small, cohesive set of widgets:
47
47
Each widget is built with consistent spacing, alignment, and interaction patterns.
48
48
The goal is not to cover everything, but to make a minimal set look and feel right out of the box.
49
49
50
-
---
51
-
52
-
## Animation & Easing
50
+
## Animation
53
51
54
52
Unlike most tiny immediate-mode UI libraries, leanUI has animation built in:
55
53
56
54
- Hover, press and toggle states are automatically eased over time.
57
-
- Animation framerate independant, uses delta time between frames.
55
+
- Animation framerate independent, uses delta time between frames.
58
56
- No per-widget state is stored — transitions are computed implicitly based on widget identity.
59
57
60
58
This gives small UIs a fluid, modern feel without adding complexity to your code.
61
59
62
-
---
63
-
64
60
## Layout
65
61
66
-
Very simple and effective (no rows, no columns)
62
+
Very simple and effective layout (no rows or columns)
67
63
- Horizontal alignment : left, center or right
68
64
- Manually call to ui_newline to make a carriage return
69
65
66
+
---
67
+
68
+
## Integration
69
+
70
+
You just need to add lean_ui.c/h to your project, set the callbacks at init and update input/delta_time each frame.
71
+
72
+
### Callbacks
73
+
-**draw_box**: The rectangle’s rounded corners are expected to fit entirely within the rectangle’s bounds; no part of the corner should extend beyond x, y, width, or height.
74
+
75
+
-**draw_text**: Draws text at (x, y). The y coordinate specifies the top, but the text will be centered vertically relative to the font height.
76
+
77
+
-**set_clip_rect**: Sets a clipping rectangle so that all subsequent drawing is limited to (x, y, width, height). You can ignore this callback if no widget will be drawn outside the window frame.
78
+
79
+
-**text_width**: Returns the width that the renderer would need to draw the specified text.
80
+
81
+
82
+
### Inputs
83
+
84
+
***ui_update_mouse_pos**: Should be called each time the mouse moves
85
+
***ui_update_mouse_button**: Call this function whenever a mouse button changes state. Do not call with button_pressed param if the button remains pressed.
86
+
87
+
---
88
+
70
89
## Example
71
90
72
91
For a complete and compiling example see [test/test.c](test/test.c)
0 commit comments