Grid part 1

This commit is contained in:
Synthasmagoria 2026-07-22 11:48:24 +02:00
commit 60622ccca5
3 changed files with 164 additions and 12 deletions

View file

@ -46,8 +46,7 @@ UiState :: struct {
UiStyle :: struct {
margin, padding: f32,
font_size, font_sep: f32,
font: rl.Font,
font_style: FontStyle,
}
ui_init :: proc(state: ^UiState, style: UiStyle, origin: v2, allocator: mem.Allocator) {
@ -133,7 +132,7 @@ UiElementData_Text :: struct {
ui_text :: proc(data: UiElementData_Text) {
state := state_current
size := rl.MeasureTextEx(state.style.font, data.text, state.style.font_size, state.style.font_sep)
size := measure_text(data.text, state.style.font_style)
area := _ui_advance_element(state, size)
state.id_current.element_index += 1
append(&state.elements, UiElement{id = state.id_current, area = area, type = .Text, data = data})