os_read, ui misc
This commit is contained in:
18
src/ui/ui.c
18
src/ui/ui.c
@@ -389,10 +389,10 @@ struct ui_draw_compute_t {
|
||||
|
||||
fn r2f32_t ui_get_appear_rect(ui_box_t *box) {
|
||||
r2f32_t result = box->rect;
|
||||
f32 appear_t = f32_ease_out_n(f32_clamp01(box->appear_t * 2), 10);
|
||||
if (!ui_id_is_null(box->id)) {
|
||||
if (box->flags.animate_appear && !ui_id_is_null(box->id)) {
|
||||
v2f32_t size = v2f32_muls(r2f32_get_size(result), 0.15f);
|
||||
r2f32_t smaller_rect = r2f32_shrink(result, size);
|
||||
f32 appear_t = f32_ease_out_n(f32_clamp01(box->appear_t * 2), 10);
|
||||
result = r2f32_lerp(smaller_rect, result, appear_t);
|
||||
}
|
||||
return result;
|
||||
@@ -622,7 +622,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_box(.loc = loc, .string = string, .flags = {.draw_text = true});
|
||||
ui_box_t *box = ui_box(.loc = loc, .string = string, .flags = {.draw_text = true, .animate_appear = true});
|
||||
return box;
|
||||
}
|
||||
|
||||
@@ -751,13 +751,13 @@ fn void ui_end_reversal(void) {
|
||||
|
||||
ui_box_t *first2 = NULL;
|
||||
ui_box_t *last2 = NULL;
|
||||
for (ui_box_t *it = first, *next = it->next; next; it = next) {
|
||||
for (ui_box_t *it = first, *next = NULL; it; it = next) {
|
||||
next = it->next;
|
||||
DLLQ_REMOVE(it->parent->first, it->parent->last, it);
|
||||
DLLQ_APPEND(first2, last2, it);
|
||||
}
|
||||
|
||||
for (ui_box_t *it = last2, *prev = it->prev; prev; it = prev) {
|
||||
for (ui_box_t *it = last2, *prev = NULL; it; it = prev) {
|
||||
prev = it->prev;
|
||||
DLLQ_REMOVE(first2, last2, it);
|
||||
DLLQ_APPEND(it->parent->first, it->parent->last, it);
|
||||
@@ -1192,11 +1192,11 @@ fn void ui_begin_frame(app_frame_t *frame) {
|
||||
fn void ui_end_frame(void) {
|
||||
for (ui_box_t *box = ui->hash_first, *next = NULL; box; box = next) {
|
||||
next = box->hash_next;
|
||||
// if (box->flags.animate_appear) {
|
||||
if (box->flags.animate_appear) {
|
||||
box->appear_t += (f32)ui->frame->delta;
|
||||
// } else {
|
||||
// box->appear_t = 1;
|
||||
// }
|
||||
} else {
|
||||
box->appear_t = 1;
|
||||
}
|
||||
if (ui_is_hot_box(box)) {
|
||||
box->hot_t += (f32)ui->frame->delta;
|
||||
} else {
|
||||
|
||||
@@ -169,7 +169,6 @@ fn b32 ui_is_focused_box(ui_box_t *box) { return !ui_is_null_box(box) && box->id
|
||||
#define ui_dm(V) ((V) * rn->main_font->computed_xchar_size)
|
||||
#define ui_max 200000000.f
|
||||
#define ui_children_sum 0
|
||||
#define ui_box_flags(...) (ui_box_flag_t){__VA_ARGS__}
|
||||
|
||||
fn ui_id_t ui_id(s8_t string);
|
||||
fn ui_id_t ui_idf(char *str, ...);
|
||||
|
||||
Reference in New Issue
Block a user