new ui_box helper
This commit is contained in:
157
src/ui/ui.c
157
src/ui/ui.c
@@ -75,6 +75,7 @@ fn u64 ui_hash_code_loc(ui_code_loc_t loc) {
|
||||
return result;
|
||||
}
|
||||
|
||||
#define ui_id_here() ui_id_from_loc(UILOC)
|
||||
fn ui_id_t ui_id_from_loc(ui_code_loc_t loc) {
|
||||
u64 id = ui_hash_code_loc(loc);
|
||||
ui_id_t result = {id};
|
||||
@@ -167,7 +168,6 @@ fn void ui_offset_box(ui_box_t *box, v2f32_t offset) {
|
||||
box->rect = r2f32_sub_v2f32(box->rect, offset);
|
||||
}
|
||||
|
||||
#define ui_box(...) ui_build_box_from_id(UILOC, __VA_ARGS__)
|
||||
fn ui_box_t *ui_build_box_from_id(ui_code_loc_t loc, ui_box_flags_t flags, ui_id_t id) {
|
||||
ui_box_t *box = ui_find_box(id);
|
||||
if (box) {
|
||||
@@ -186,15 +186,13 @@ fn ui_box_t *ui_build_box_from_id(ui_code_loc_t loc, ui_box_flags_t flags, ui_id
|
||||
box->flags = flags;
|
||||
box->text_align = ui_top_text_align();
|
||||
box->border_thickness = ui_top_border_thickness();
|
||||
box->string_pos_offset = ui_top_string_pos_offset();
|
||||
ui_box_fill_with_colors(box);
|
||||
ui_push_box(ui->top, box);
|
||||
return box;
|
||||
}
|
||||
|
||||
fn ui_box_t *ui_build_box_from_string(ui_code_loc_t loc, ui_box_flags_t flags, s8_t string) {
|
||||
ui_id_t id = ui_id(string);
|
||||
ui_box_t *box = ui_build_box_from_id(loc, flags, id);
|
||||
box->string = ui_get_display_string(string);
|
||||
fn void ui_box_auto_rect(ui_box_t *box) {
|
||||
v2f32_t string_size = rn_measure_string(rn->main_font, box->string);
|
||||
ui_axis2_t axis = ui_axis_from_lop(ui_top_lop());
|
||||
if (ui->required_size_stack && (axis == ui_axis2_x || axis == ui_axis2_y)) {
|
||||
@@ -207,24 +205,45 @@ fn ui_box_t *ui_build_box_from_string(ui_code_loc_t loc, ui_box_flags_t flags, s
|
||||
r2f32_t rect = ui_next_rect(ui_top_lop(), &ui->top->rect, string_size);
|
||||
ui_set_rect(box, rect);
|
||||
}
|
||||
box->string_pos_offset = ui_top_string_pos_offset();
|
||||
}
|
||||
|
||||
fn ui_box_t *ui_build_box_from_string(ui_code_loc_t loc, ui_box_flags_t flags, s8_t string) {
|
||||
ui_id_t id = ui_id(string);
|
||||
ui_box_t *box = ui_build_box_from_id(loc, flags, id);
|
||||
box->string = ui_get_display_string(string);
|
||||
ui_box_auto_rect(box);
|
||||
return box;
|
||||
}
|
||||
|
||||
#define ui_boxf(...) ui__boxf(UILOC, __VA_ARGS__)
|
||||
fn ui_box_t *ui__boxf(ui_code_loc_t loc, ui_box_flags_t flags, char *str, ...) {
|
||||
S8_FMT(tcx->temp, str, string);
|
||||
flags.dont_compute_rect = true;
|
||||
ui_box_t *box = ui_build_box_from_string(loc, flags, string);
|
||||
return box;
|
||||
typedef struct ui_box_params_t ui_box_params_t;
|
||||
struct ui_box_params_t {
|
||||
ui_code_loc_t loc;
|
||||
r2f32_t rect;
|
||||
ui_box_flags_t flags;
|
||||
s8_t string;
|
||||
ui_id_t id;
|
||||
b32 null_id; // normally null id is interpreted as no value
|
||||
};
|
||||
|
||||
#define ui_box(...) ui__make_box((ui_box_params_t){.loc = UILOC, __VA_ARGS__})
|
||||
fn ui_box_t *ui__make_box(ui_box_params_t params) {
|
||||
ui_id_t id = params.id;
|
||||
if (ui_id_is_null(id) && params.null_id == false) {
|
||||
if (params.string.len != 0) {
|
||||
id = ui_id(params.string);
|
||||
}
|
||||
if (ui_id_is_null(id)) {
|
||||
id = ui_id_from_loc(params.loc);
|
||||
}
|
||||
}
|
||||
ui_box_t *box = ui_build_box_from_id(params.loc, params.flags, id);
|
||||
box->string = ui_get_display_string(params.string);
|
||||
if (r2f32_is_null(params.rect)) {
|
||||
ui_box_auto_rect(box);
|
||||
} else {
|
||||
ui_set_rect(box, params.rect);
|
||||
}
|
||||
|
||||
#define ui_box0(...) ui_build_box_from_id(UILOC, __VA_ARGS__, ui_null_id)
|
||||
#define ui_box0f(...) ui__box0f(UILOC, __VA_ARGS__)
|
||||
fn ui_box_t *ui__box0f(ui_code_loc_t loc, ui_box_flags_t flags, char *str, ...) {
|
||||
S8_FMT(tcx->temp, str, string);
|
||||
ui_box_t *box = ui_build_box_from_id(loc, flags, ui_null_id);
|
||||
box->string = string;
|
||||
return box;
|
||||
}
|
||||
|
||||
@@ -337,8 +356,11 @@ fn ui_draw_compute_t ui_draw_compute(ui_box_t *box) {
|
||||
co.background_color = v4f32_lerp(co.background_color, box->bg_hot_color, hot_t);
|
||||
// co.text_color = v4f32_lerp(co.background_color, box->text_hot_color, hot_t);
|
||||
box->flags.draw_rect = true;
|
||||
} else if (ui_is_focused_box(box)) {
|
||||
co.background_color = ui_color_table[ui_color_focused_rect];
|
||||
}
|
||||
|
||||
if (ui_is_focused_box(box)) {
|
||||
co.background_color = v4f32_lerp(co.background_color, ui_color_table[ui_color_focused_rect], 0.4f);
|
||||
|
||||
// co.text_color = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.6f, 0.7f, 1.0f});
|
||||
box->flags.draw_rect = true;
|
||||
}
|
||||
@@ -432,7 +454,8 @@ fn_test void ui_test_text_replace(void) {
|
||||
|
||||
#define ui_text_input(ti) ui__text_input(UILOC, ti)
|
||||
fn ui_signal_t ui__text_input(ui_code_loc_t loc, ui_text_input_t *ti) {
|
||||
ui_box_t *box = ui_build_box_from_string(loc, (ui_box_flags_t){ .draw_border = true, .draw_rect = true, .draw_text = true, .keyboard_nav = true }, s8_lit("text_input"));
|
||||
ui_box_t *box = ui_box(.loc = loc, .string = s8_lit("text_input"), .flags = { .draw_border = true, .draw_rect = true, .draw_text = true, .keyboard_nav = true });
|
||||
|
||||
box->text_input = ti;
|
||||
box->custom_draw = ui_text_input_draw;
|
||||
|
||||
@@ -492,7 +515,7 @@ fn ui_signal_t ui__text_input(ui_code_loc_t loc, ui_text_input_t *ti) {
|
||||
#define ui_button(...) ui__button(UILOC, __VA_ARGS__)
|
||||
fn ui_signal_t ui__button(ui_code_loc_t loc, char *str, ...) {
|
||||
S8_FMT(tcx->temp, str, string);
|
||||
ui_box_t *box = ui_build_box_from_string(loc, (ui_box_flags_t){ .draw_border = true, .draw_rect = true, .draw_text = true, .keyboard_nav = true }, string);
|
||||
ui_box_t *box = ui_box(.loc = loc, .string = string, .flags = { .draw_border = true, .draw_rect = true, .draw_text = true, .keyboard_nav = true });
|
||||
ui_signal_t signal = ui_signal_from_box(box);
|
||||
return signal;
|
||||
}
|
||||
@@ -500,18 +523,18 @@ fn ui_signal_t ui__button(ui_code_loc_t loc, char *str, ...) {
|
||||
#define ui_radio_button(...) ui__radio_button(UILOC, __VA_ARGS__)
|
||||
fn ui_signal_t ui__radio_button(ui_code_loc_t loc, i32 *value, i32 value_clicked, char *str, ...) {
|
||||
S8_FMT(tcx->temp, str, string);
|
||||
ui_box_t *box = ui_build_box_from_string(loc, (ui_box_flags_t){ .draw_border = true, .draw_rect = true, .draw_text = true, .keyboard_nav = true }, string);
|
||||
ui_box_t *box = ui_box(.loc = loc, .string = string, .flags = { .draw_border = true, .draw_rect = true, .draw_text = true, .keyboard_nav = true });
|
||||
ui_signal_t signal = ui_signal_from_box(box);
|
||||
if (signal.clicked) *value = value_clicked;
|
||||
// @todo?
|
||||
if (*value == value_clicked) box->background_color = ui_top_bg_active_color();
|
||||
if (*value == value_clicked) box->background_color = ui_color_table[ui_color_rect_turned_on];
|
||||
return signal;
|
||||
}
|
||||
|
||||
#define ui_label_button(...) ui__label_button(UILOC, __VA_ARGS__)
|
||||
fn ui_signal_t ui__label_button(ui_code_loc_t loc, char *str, ...) {
|
||||
S8_FMT(tcx->temp, str, string);
|
||||
ui_box_t *box = ui_build_box_from_string(loc, (ui_box_flags_t){ .draw_text = true, .keyboard_nav = true }, string);
|
||||
ui_box_t *box = ui_box(.loc = loc, .string = string, .flags = {.draw_text = true, .keyboard_nav = true});
|
||||
ui_signal_t signal = ui_signal_from_box(box);
|
||||
return signal;
|
||||
}
|
||||
@@ -519,7 +542,7 @@ fn ui_signal_t ui__label_button(ui_code_loc_t loc, char *str, ...) {
|
||||
#define ui_label(...) ui__label(UILOC, __VA_ARGS__)
|
||||
fn ui_box_t *ui__label(ui_code_loc_t loc, char *str, ...) {
|
||||
S8_FMT(tcx->temp, str, string);
|
||||
ui_box_t *box = ui_build_box_from_string(loc, (ui_box_flags_t){ .draw_text = true, }, string);
|
||||
ui_box_t *box = ui_box(.loc = loc, .string = string, .flags = {.draw_text = true});
|
||||
return box;
|
||||
}
|
||||
|
||||
@@ -527,7 +550,7 @@ fn ui_box_t *ui__label(ui_code_loc_t loc, char *str, ...) {
|
||||
#define ui_begin_expander(...) ui__begin_expander(UILOC, __VA_ARGS__)
|
||||
fn ui_signal_t ui__begin_expander(ui_code_loc_t loc, char *str, ...) {
|
||||
S8_FMT(tcx->temp, str, string);
|
||||
ui_box_t *box = ui_build_box_from_string(loc, (ui_box_flags_t){ .draw_text = true, .keyboard_nav = true }, string);
|
||||
ui_box_t *box = ui_box(.loc = loc, .string = string, .flags = { .draw_text = true, .keyboard_nav = true });
|
||||
if (box->created_new) box->expanded = true;
|
||||
ui_signal_t signal = ui_signal_from_box(box);
|
||||
if (signal.clicked) box->expanded = !box->expanded;
|
||||
@@ -635,10 +658,6 @@ fn void ui_end_build(void) {
|
||||
ui->focus = ui_get_prev_box(focus_box, ui_match_keynav)->id;
|
||||
} else if (ev->kind == app_event_kind_key_down && ev->key == app_key_down) {
|
||||
ui->focus = ui_get_next_box(focus_box, ui_match_keynav)->id;
|
||||
} else if (ev->kind == app_event_kind_key_down && ev->key == app_key_right) {
|
||||
// ui->focus = ui_get_right_box(focus_box)->id;
|
||||
} else if (ev->kind == app_event_kind_key_down && ev->key == app_key_left) {
|
||||
// ui->focus = ui_get_left_box(focus_box)->id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -972,10 +991,11 @@ fn void ui_demo_update(app_frame_t *frame, mt_tweak_t *tweak_table, i32 tweak_co
|
||||
ui_g_panel = 1;
|
||||
} else if (ev->kind == app_event_kind_key_down && ev->key == app_key_f2) {
|
||||
ui_g_panel = 2;
|
||||
} else if (ev->kind == app_event_kind_key_down && ev->key == app_key_f3) {
|
||||
ui_g_panel = 3;
|
||||
}
|
||||
|
||||
ui_box_t *top_box = ui_box0((ui_box_flags_t){.draw_rect = true, .clip_rect = true});
|
||||
ui_set_rect(top_box, r2f32_cut_top(&ui->top->rect, ui_em(1.5f)));
|
||||
ui_box_t *top_box = ui_box(.null_id = true, .rect = r2f32_cut_top(&ui->top->rect, ui_em(1.5f)), .flags = {.draw_rect = true, .clip_rect = true});
|
||||
ui_set_padding(ui_em(3))
|
||||
ui_set_text_align(ui_text_align_center)
|
||||
ui_set_lop(ui_lop_cut_left)
|
||||
@@ -990,14 +1010,10 @@ fn void ui_demo_update(app_frame_t *frame, mt_tweak_t *tweak_table, i32 tweak_co
|
||||
///////////////////////////////
|
||||
// First list panel
|
||||
if (ui_g_panel == 1) {
|
||||
ui_box_t *scroller_box = ui_boxf((ui_box_flags_t){.draw_rect = true, .clip_rect = true}, "scrollbar");
|
||||
ui_set_rect(scroller_box, r2f32_cut_right(&ui->top->rect, 10 * frame->dpr));
|
||||
|
||||
ui_box_t *item_box = ui_boxf((ui_box_flags_t){.draw_rect = true, .clip_rect = true}, "item_box");
|
||||
ui_set_rect(item_box, r2f32_cut_left(&ui->top->rect, ui_max));
|
||||
ui_box_t *scroller_box = ui_box(r2f32_cut_right(&ui->top->rect, 10 * frame->dpr), {.draw_rect = true, .clip_rect = true});
|
||||
ui_box_t *item_box = ui_box(r2f32_cut_left(&ui->top->rect, ui_max), {.draw_rect = true, .clip_rect = true});
|
||||
item_box->rect = r2f32_shrinks(item_box->rect, ui_em(1));
|
||||
|
||||
|
||||
ui_set_text_align(ui_text_align_left)
|
||||
ui_set_top(item_box) {
|
||||
locl char buff[128];
|
||||
@@ -1049,14 +1065,10 @@ fn void ui_demo_update(app_frame_t *frame, mt_tweak_t *tweak_table, i32 tweak_co
|
||||
f32 scroller_norm = scroller_value / (all_items_size);
|
||||
f32 scroller_percent = scroller_norm * scrollable_space;
|
||||
f32 slider_box_size = scroller_size * scroller_box_size;
|
||||
// f32 scroller_second = scrollable_space - scroller_percent;
|
||||
|
||||
ui_box_t *upper_box = ui_boxf((ui_box_flags_t){.draw_rect = true}, "upper_box");
|
||||
ui_box_t *slider_box = ui_boxf((ui_box_flags_t){.draw_rect = true}, "slider_box");
|
||||
ui_box_t *down_box = ui_boxf((ui_box_flags_t){.draw_rect = true}, "down_box");
|
||||
ui_set_rect(upper_box, r2f32_cut_top(&ui->top->rect, scroller_percent * scroller_box_size));
|
||||
ui_set_rect(slider_box, r2f32_cut_top(&ui->top->rect, slider_box_size));
|
||||
ui_set_rect(down_box, r2f32_cut_top(&ui->top->rect, ui_max));
|
||||
ui_box_t *upper_box = ui_box(r2f32_cut_top(&ui->top->rect, scroller_percent * scroller_box_size), {.draw_rect = true});
|
||||
ui_box_t *slider_box = ui_box(r2f32_cut_top(&ui->top->rect, slider_box_size), {.draw_rect = true});
|
||||
ui_box_t *down_box = ui_box(r2f32_cut_top(&ui->top->rect, ui_max), {.draw_rect = true});
|
||||
slider_box->background_color = ui_color_table[ui_color_scroller];
|
||||
slider_box->bg_hot_color = ui_color_table[ui_color_scroller_hot];
|
||||
slider_box->bg_active_color = ui_color_table[ui_color_scroller_active];
|
||||
@@ -1219,11 +1231,8 @@ fn void ui_demo_update(app_frame_t *frame, mt_tweak_t *tweak_table, i32 tweak_co
|
||||
}
|
||||
}
|
||||
|
||||
ui_box_t *scroller_box = ui_boxf((ui_box_flags_t){.draw_rect = true, .clip_rect = true}, "scrollbar");
|
||||
ui_set_rect(scroller_box, r2f32_cut_right(&ui->top->rect, 10 * frame->dpr));
|
||||
|
||||
ui_box_t *item_box = ui_boxf((ui_box_flags_t){.draw_rect = true, .clip_rect = true}, "item_box");
|
||||
ui_set_rect(item_box, r2f32_cut_left(&ui->top->rect, ui_max));
|
||||
ui_box_t *right_scroller = ui_box(.rect = r2f32_cut_right(&ui->top->rect, 10 * frame->dpr), .flags = {.draw_rect = true, .clip_rect = true});
|
||||
ui_box_t *item_box = ui_box(.rect = r2f32_cut_left(&ui->top->rect, ui_max), .flags = {.draw_rect = true, .clip_rect = true});
|
||||
|
||||
locl f32 scroller_value;
|
||||
|
||||
@@ -1246,19 +1255,16 @@ fn void ui_demo_update(app_frame_t *frame, mt_tweak_t *tweak_table, i32 tweak_co
|
||||
}
|
||||
}
|
||||
|
||||
defer_block(ui_push_top(scroller_box), ui_pop_top()) {
|
||||
f32 scroller_box_size = r2f32_get_size(scroller_box->full_rect).y;
|
||||
defer_block(ui_push_top(right_scroller), ui_pop_top()) {
|
||||
f32 right_scroller_size = r2f32_get_size(right_scroller->full_rect).y;
|
||||
f32 scroller_size = CLAMP(item_box_size / (all_items_size + frame->window_size.y), 0, 1.0f);
|
||||
f32 scrollable_space = (1 - scroller_size);
|
||||
f32 scroller_norm = scroller_value / (all_items_size);
|
||||
f32 scroller_percent = scroller_norm * scrollable_space;
|
||||
|
||||
ui_box_t *upper_box = ui_boxf((ui_box_flags_t){.draw_rect = true}, "upper_box");
|
||||
ui_box_t *slider_box = ui_boxf((ui_box_flags_t){.draw_rect = true}, "slider_box");
|
||||
ui_box_t *down_box = ui_boxf((ui_box_flags_t){.draw_rect = true}, "down_box");
|
||||
ui_set_rect(upper_box, r2f32_cut_top(&ui->top->rect, scroller_percent * scroller_box_size));
|
||||
ui_set_rect(slider_box, r2f32_cut_top(&ui->top->rect, scroller_size * scroller_box_size));
|
||||
ui_set_rect(down_box, r2f32_cut_top(&ui->top->rect, ui_max));
|
||||
ui_box_t *upper_box = ui_box(r2f32_cut_top(&ui->top->rect, scroller_percent * right_scroller_size), {.draw_rect = true});
|
||||
ui_box_t *slider_box = ui_box(r2f32_cut_top(&ui->top->rect, scroller_size * right_scroller_size), {.draw_rect = true});
|
||||
ui_box_t *down_box = ui_box(r2f32_cut_top(&ui->top->rect, ui_max), {.draw_rect = true});
|
||||
slider_box->background_color = ui_color_table[ui_color_scroller];
|
||||
slider_box->bg_hot_color = ui_color_table[ui_color_scroller_hot];
|
||||
slider_box->bg_active_color = ui_color_table[ui_color_scroller_active];
|
||||
@@ -1286,8 +1292,7 @@ fn void ui_demo_update(app_frame_t *frame, mt_tweak_t *tweak_table, i32 tweak_co
|
||||
}
|
||||
|
||||
if (ui_g_panel == 3) {
|
||||
ui_box_t *item_box = ui_boxf((ui_box_flags_t){.draw_rect = true, .clip_rect = true}, "item_box");
|
||||
ui_set_rect(item_box, r2f32_cut_left(&ui->top->rect, ui_max));
|
||||
ui_box_t *item_box = ui_box(.rect = r2f32_cut_left(&ui->top->rect, ui_max), .flags = {.draw_rect = true, .clip_rect = true});
|
||||
ui_set_top(item_box) {
|
||||
ui_label("right click to bring up the context menu!");
|
||||
}
|
||||
@@ -1304,9 +1309,7 @@ fn void ui_demo_update(app_frame_t *frame, mt_tweak_t *tweak_table, i32 tweak_co
|
||||
}
|
||||
|
||||
if (context_menu_open) {
|
||||
ui_box_t *menu = ui_boxf((ui_box_flags_t){.draw_border = true, .draw_rect = true}, "context_menu");
|
||||
ui_set_rect(menu, r2f32_min_dim(menu_pos, v2f32(ui_em(10), ui_to_be_determined)));
|
||||
|
||||
ui_box_t *menu = ui_box(.rect = r2f32_min_dim(menu_pos, v2f32(ui_em(10), ui_to_be_determined)), .flags = {.draw_border = true, .draw_rect = true});
|
||||
ui_set_top(menu)
|
||||
ui_set_text_align(ui_text_align_left)
|
||||
ui_set_string_pos_offset(ui_em(1))
|
||||
@@ -1340,16 +1343,14 @@ fn void ui_demo_update(app_frame_t *frame, mt_tweak_t *tweak_table, i32 tweak_co
|
||||
}
|
||||
|
||||
if (lister_open) {
|
||||
ui_box_t *lister = ui_box((ui_box_flags_t){.draw_rect = true, .draw_border = true, .clip_rect = true}, lister_id);
|
||||
ui_set_top(lister)
|
||||
ui_set_lop(ui_lop_cut_top) {
|
||||
v2f32_t max_size = v2f32_sub(frame->window_size, v2f32(ui_em(2), ui_em(2)));
|
||||
v2f32_t _lister_size = v2f32(ui_em(50), ui_em(40));
|
||||
v2f32_t lister_size = v2f32_clamp(_lister_size, v2f32_null, max_size);
|
||||
v2f32_t pos = v2f32_divs(v2f32_sub(frame->window_size, lister_size), 2.0);
|
||||
r2f32_t rect = r2f32_min_dim(pos, lister_size);
|
||||
ui_set_rect(lister, rect);
|
||||
|
||||
ui_box_t *lister = ui_box(.id = lister_id, .rect = rect, .flags = {.draw_rect = true, .draw_border = true, .clip_rect = true});
|
||||
ui_set_top(lister)
|
||||
ui_set_lop(ui_lop_cut_top) {
|
||||
locl char buff[128];
|
||||
locl ui_text_input_t text_input;
|
||||
if (text_input.str == NULL) {
|
||||
@@ -1359,15 +1360,15 @@ fn void ui_demo_update(app_frame_t *frame, mt_tweak_t *tweak_table, i32 tweak_co
|
||||
ui_signal_t ti_sig = ui_text_input(&text_input);
|
||||
if (lister_just_opened) ui->focus = ti_sig.box->id;
|
||||
|
||||
ui_label("[27.01.2025 08:55:20] Module loaded: 00007ff9`26860000 00007ff9`26908000 C:/Windows/System32/clbcatq.dll ");
|
||||
ui_label("[27.01.2025 08:55:20] Module loaded: 00007ff9`06a80000 00007ff9`06add000 C:/Windows/System32/ApplicationTargetedFeatureDatabase.dll ");
|
||||
ui_label("[27.01.2025 08:55:20] Module loaded: 00007ff9`16a50000 00007ff9`16c87000 C:/Windows/System32/twinapi.appcore.dll ");
|
||||
ui_label("[27.01.2025 08:55:20] Thread exited: handle 0x854 with exit code 0 (0x0)");
|
||||
ui_label("[27.01.2025 08:55:20] Module loaded: 00007ff9`1c410000 00007ff9`1c51f000 C:/dev/wasm/build/app_temp_2106011489.dll (symbols loaded)");
|
||||
ui_label("opengl message: Buffer detailed info: Buffer object 1 (bound to NONE, usage hint is GL_DYNAMIC_DRAW) will use VIDEO memory as the source for buffer object operations.");
|
||||
ui_label("failed to load library: app_temp_1403378047.dll");
|
||||
ui_label("failed to load library: app_temp_1765879053.dll");
|
||||
ui_label("failed to load library: app_temp_1515670551.dll");
|
||||
ui_button("[27.01.2025 08:55:20] Module loaded: 00007ff9`26860000 00007ff9`26908000 C:/Windows/System32/clbcatq.dll ");
|
||||
ui_button("[27.01.2025 08:55:20] Module loaded: 00007ff9`06a80000 00007ff9`06add000 C:/Windows/System32/ApplicationTargetedFeatureDatabase.dll ");
|
||||
ui_button("[27.01.2025 08:55:20] Module loaded: 00007ff9`16a50000 00007ff9`16c87000 C:/Windows/System32/twinapi.appcore.dll ");
|
||||
ui_button("[27.01.2025 08:55:20] Thread exited: handle 0x854 with exit code 0 (0x0)");
|
||||
ui_button("[27.01.2025 08:55:20] Module loaded: 00007ff9`1c410000 00007ff9`1c51f000 C:/dev/wasm/build/app_temp_2106011489.dll (symbols loaded)");
|
||||
ui_button("opengl message: Buffer detailed info: Buffer object 1 (bound to NONE, usage hint is GL_DYNAMIC_DRAW) will use VIDEO memory as the source for buffer object operations.");
|
||||
ui_button("failed to load library: app_temp_1403378047.dll");
|
||||
ui_button("failed to load library: app_temp_1765879053.dll");
|
||||
ui_button("failed to load library: app_temp_1515670551.dll");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ type_t type__ui_color_t = { type_kind_enum, s8_const_lit("ui_color_t"), sizeof(u
|
||||
{.name = s8_const_lit("ui_color_rect"), .value = ui_color_rect},
|
||||
{.name = s8_const_lit("ui_color_rect_hot"), .value = ui_color_rect_hot},
|
||||
{.name = s8_const_lit("ui_color_rect_active"), .value = ui_color_rect_active},
|
||||
{.name = s8_const_lit("ui_color_rect_turned_on"), .value = ui_color_rect_turned_on},
|
||||
{.name = s8_const_lit("ui_color_border"), .value = ui_color_border},
|
||||
{.name = s8_const_lit("ui_color_text"), .value = ui_color_text},
|
||||
{.name = s8_const_lit("ui_color_text_hot"), .value = ui_color_text_hot},
|
||||
@@ -14,7 +15,7 @@ type_t type__ui_color_t = { type_kind_enum, s8_const_lit("ui_color_t"), sizeof(u
|
||||
{.name = s8_const_lit("ui_color_scroller_hot"), .value = ui_color_scroller_hot},
|
||||
{.name = s8_const_lit("ui_color_scroller_active"), .value = ui_color_scroller_active},
|
||||
},
|
||||
.count = 11,
|
||||
.count = 12,
|
||||
};
|
||||
gb v4f32_t ui_color_table[] = {
|
||||
{0},
|
||||
@@ -28,17 +29,19 @@ gb v4f32_t ui_color_table[] = {
|
||||
{0},
|
||||
{0},
|
||||
{0},
|
||||
{0},
|
||||
};
|
||||
|
||||
fn void ui_init_colors(void) {
|
||||
ui_color_table[ui_color_rect] = v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.95f, 1.0f});
|
||||
ui_color_table[ui_color_rect_hot] = v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.5f, 0.95f, 1.0f});
|
||||
ui_color_table[ui_color_rect_active] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.5f, 0.95f, 1.0f});
|
||||
ui_color_table[ui_color_rect_turned_on] = v4f32_hsla_to_rgba((v4f32_t){0.4f, 0.5f, 0.95f, 1.0f});
|
||||
ui_color_table[ui_color_border] = v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.70f, 1.0f});
|
||||
ui_color_table[ui_color_text] = v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.70f, 1.0f});
|
||||
ui_color_table[ui_color_text_hot] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.4f, 0.70f, 1.0f});
|
||||
ui_color_table[ui_color_text_active] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.5f, 0.70f, 1.0f});
|
||||
ui_color_table[ui_color_focused_rect] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.6f, 0.95f, 1.0f});
|
||||
ui_color_table[ui_color_focused_rect] = (v4f32_t){1,1,1,1};
|
||||
ui_color_table[ui_color_scroller] = ui_color_table[ui_color_text];
|
||||
ui_color_table[ui_color_scroller_hot] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.2f, 0.7f, 1.0f});
|
||||
ui_color_table[ui_color_scroller_active] = v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.2f, 0.5f, 1.0f});
|
||||
|
||||
@@ -3,6 +3,7 @@ typedef enum {
|
||||
ui_color_rect,
|
||||
ui_color_rect_hot,
|
||||
ui_color_rect_active,
|
||||
ui_color_rect_turned_on,
|
||||
ui_color_border,
|
||||
ui_color_text,
|
||||
ui_color_text_hot,
|
||||
|
||||
@@ -4,11 +4,12 @@ fn void mt_ui_colors(ma_arena_t *arena, sb8_t *c, sb8_t *h) {
|
||||
{ rect `v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.95f, 1.0f})` }
|
||||
{ rect_hot `v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.5f, 0.95f, 1.0f})` }
|
||||
{ rect_active `v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.5f, 0.95f, 1.0f})` }
|
||||
{ rect_turned_on `v4f32_hsla_to_rgba((v4f32_t){0.4f, 0.5f, 0.95f, 1.0f})` }
|
||||
{ border `v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.70f, 1.0f})` }
|
||||
{ text `v4f32_hsla_to_rgba((v4f32_t){0.0f, 0.2f, 0.70f, 1.0f})` }
|
||||
{ text_hot `v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.4f, 0.70f, 1.0f})` }
|
||||
{ text_active `v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.5f, 0.70f, 1.0f})` }
|
||||
{ focused_rect `v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.6f, 0.95f, 1.0f})` }
|
||||
{ focused_rect `(v4f32_t){1,1,1,1}` }
|
||||
{ scroller `ui_color_table[ui_color_text]` }
|
||||
{ scroller_hot `v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.2f, 0.7f, 1.0f})` }
|
||||
{ scroller_active `v4f32_hsla_to_rgba((v4f32_t){0.1f, 0.2f, 0.5f, 1.0f})` }
|
||||
|
||||
4
todo.txt
4
todo.txt
@@ -24,9 +24,9 @@
|
||||
[ ] ui
|
||||
[ ] table
|
||||
[ ] vertical scroll
|
||||
[ ] right click menu
|
||||
[ ] context menu
|
||||
[ ] hover tooltips
|
||||
[ ] upper left context menu dynamics
|
||||
[ ] upper left menu dynamics
|
||||
[x] debug console, lines
|
||||
[x] fix elements getting offset when font large and they are on the edge
|
||||
[ ] text input
|
||||
|
||||
Reference in New Issue
Block a user