Skip to content

Commit 9752451

Browse files
committed
added integration section to readme
1 parent d2f4d53 commit 9752451

1 file changed

Lines changed: 26 additions & 7 deletions

File tree

README.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,45 @@ leanUI provides a small, cohesive set of widgets:
4747
Each widget is built with consistent spacing, alignment, and interaction patterns.
4848
The goal is not to cover everything, but to make a minimal set look and feel right out of the box.
4949

50-
---
51-
52-
## Animation & Easing
50+
## Animation
5351

5452
Unlike most tiny immediate-mode UI libraries, leanUI has animation built in:
5553

5654
- 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.
5856
- No per-widget state is stored — transitions are computed implicitly based on widget identity.
5957

6058
This gives small UIs a fluid, modern feel without adding complexity to your code.
6159

62-
---
63-
6460
## Layout
6561

66-
Very simple and effective (no rows, no columns)
62+
Very simple and effective layout (no rows or columns)
6763
- Horizontal alignment : left, center or right
6864
- Manually call to ui_newline to make a carriage return
6965

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+
7089
## Example
7190

7291
For a complete and compiling example see [test/test.c](test/test.c)

0 commit comments

Comments
 (0)