it's working on web and in window, waow

This commit is contained in:
Krzosa Karol
2025-01-22 11:08:16 +01:00
parent 802141a234
commit e54265fcac
24 changed files with 3320 additions and 1957 deletions

View File

@@ -165,7 +165,7 @@ fn ui_signal_t ui_signal_from_box(ui_box_t *box) {
ui_signal_t result = {box};
app_event_t *ev = ui->event;
b32 move = ev->kind == app_event_kind_mouse_move;
// b32 move = ev->kind == app_event_kind_mouse_move;
b32 inside = r2f32_contains(box->final_rect, ev->mouse_pos);
if (ui_is_active_box(box)) {
@@ -624,7 +624,7 @@ fn void ui_demo_update(app_frame_t *frame) {
f32 scrollable_space = (1 - scroller_size);
f32 scroller_norm = scroller_value / (all_items_size);
f32 scroller_percent = scroller_norm * scrollable_space;
f32 scroller_second = scrollable_space - scroller_percent;
// f32 scroller_second = scrollable_space - scroller_percent;
r2f32_cut_top(&ui->top->rect, scroller_percent * scroller_box_size);
ui_box_t *box = ui_build_box_from_id(UILOC, (ui_box_flags_t){.draw_border = true, .draw_rect = true}, ui_idf("slider"));
@@ -648,10 +648,10 @@ fn void ui_demo_update(app_frame_t *frame) {
ui_end_build();
}
rn_begin();
rn_begin(frame);
ui_draw();
rn_draw_stringf(rn_state.main_font, v2f32(0, frame->window_size.y - rn_state.main_font->size), black_color_global, "boxes: %d", ui->allocated_boxes);
rn_end(frame->window_size, white_color_global);
rn_end();
ui_end_frame();
}

View File

@@ -1,3 +1,4 @@
// automatically generated using: C:\dev\wasm\src/ui/ui.meta.c
fn void ui_push_id(ui_id_t v) { ui_id_node_t *n = ma_push_type(tcx.temp, ui_id_node_t); n->value = v; SLLS_PUSH(ui->id_stack, n); }
fn void ui_pop_id(void) { SLLS_POP(ui->id_stack); }
#define ui_set_id(x) defer_block(ui_push_id(x), ui_pop_id())

View File

@@ -1,3 +1,4 @@
// automatically generated using: C:\dev\wasm\src/ui/ui.meta.c
typedef struct ui_id_node_t ui_id_node_t; struct ui_id_node_t { ui_id_t value; ui_id_node_t *next; };
typedef struct ui_lop_node_t ui_lop_node_t; struct ui_lop_node_t { ui_lop_t value; ui_lop_node_t *next; };

View File

@@ -34,6 +34,9 @@ void mt_ui(ma_arena_t *arena) {
sb8_t *h = sb8_serial_begin(arena);
sb8_t *c = sb8_serial_begin(arena);
sb8_printf(h, "// automatically generated using: " __FILE__ "\n");
sb8_printf(c, "// automatically generated using: " __FILE__ "\n");
///////////////////////////////
// generate types
for (ast_t *it = table->first; it; it = it->next) {