Unicode used in multimedia
This commit is contained in:
32
ui.cpp
32
ui.cpp
@@ -62,7 +62,7 @@ function UIWidget *ui_new_widget(Allocator *arena, UIWidgetKind kind) {
|
||||
}
|
||||
|
||||
function void ui_push_child(UIWidget *widget, UIWidget *child) {
|
||||
//DLL_QUEUE_PUSH(widget->first_child, widget->last_child, child);
|
||||
DLLQueuePush(widget->first_child, widget->last_child, child);
|
||||
}
|
||||
|
||||
function UIWidget *ui_push_child(Arena *arena, UIWidget *widget, UIWidgetKind kind) {
|
||||
@@ -171,42 +171,42 @@ function void ui_end_frame(Bitmap *dst, UI *ui, Font *font) {
|
||||
rect = vec4(pos, w->size);
|
||||
ui_mouse_test(ui, w, rect);
|
||||
String string = string_fmt(scratch, "%d %d", w->ptr.image->x, w->ptr.image->y);
|
||||
r_draw_string(dst, font, string, pos);
|
||||
r_draw_bitmap(dst, w->ptr.image, pos, w->size);
|
||||
draw_string(dst, font, string, pos);
|
||||
draw_bitmap(dst, w->ptr.image, pos, w->size);
|
||||
if (ui->active == w) {
|
||||
F32 ratio = (F32)w->ptr.image->y / (F32)w->ptr.image->x;
|
||||
w->size.x -= os.delta_mouse_pos.x;
|
||||
w->size.y = w->size.x * ratio;
|
||||
}
|
||||
if (ui->hot == w) {
|
||||
r_draw_rect(dst, rect.x, rect.y, rect.width, rect.height, vec4(1, 1, 1, 0.1f));
|
||||
draw_rect(dst, rect.x, rect.y, rect.width, rect.height, vec4(1, 1, 1, 0.1f));
|
||||
}
|
||||
} break;
|
||||
case UIWidgetKind_Boolean: {
|
||||
pos.y -= font->height;
|
||||
Vec4 color = vec4(0, 0, 0, 1);
|
||||
String string = string_fmt(scratch, "%s %d", w->text, *w->ptr.b32);
|
||||
rect = r_get_string_rect(font, string, pos);
|
||||
rect = get_string_rect(font, string, pos);
|
||||
B32 clicked = ui_mouse_test(ui, w, rect);
|
||||
if (clicked) *w->ptr.b32 = !*w->ptr.b32;
|
||||
if (ui->hot == w) {
|
||||
color = vec4(0.4f, 0.4f, 0.4f, 1.f);
|
||||
}
|
||||
rect.y = rect.y-font->line_advance / 5;
|
||||
r_draw_rect(dst, rect.x, rect.y, rect.width, rect.height, color);
|
||||
rect = r_draw_string(dst, font, string, pos);
|
||||
draw_rect(dst, rect.x, rect.y, rect.width, rect.height, color);
|
||||
rect = draw_string(dst, font, string, pos);
|
||||
pos.y -= rect.height - font->height;
|
||||
} break;
|
||||
case UIWidgetKind_Label: {
|
||||
pos.y -= font->height;
|
||||
rect = r_draw_string(dst, font, *w->ptr.label, pos);
|
||||
rect = draw_string(dst, font, *w->ptr.label, pos);
|
||||
pos.y -= rect.height - font->height;
|
||||
} break;
|
||||
case UIWidgetKind_Option: {
|
||||
pos.y -= font->height;
|
||||
Vec4 color = vec4(0, 0, 0, 1);
|
||||
String string = string_fmt(scratch, "%s %d", w->text, *w->ptr.option);
|
||||
rect = r_get_string_rect(font, string, pos);
|
||||
String string = string_fmt(scratch, "%Q %Q", w->text, *w->ptr.option);
|
||||
rect = get_string_rect(font, string, pos);
|
||||
B32 clicked = ui_mouse_test(ui, w, rect);
|
||||
if (clicked) {
|
||||
*w->ptr.b32 = (*w->ptr.b32+1) % w->option_max;
|
||||
@@ -215,15 +215,15 @@ function void ui_end_frame(Bitmap *dst, UI *ui, Font *font) {
|
||||
color = vec4(0.4f, 0.4f, 0.4f, 1.f);
|
||||
}
|
||||
rect.y = rect.y-font->line_advance / 5;
|
||||
r_draw_rect(dst, rect.x, rect.y, rect.width, rect.height, color);
|
||||
rect = r_draw_string(dst, font, string, pos);
|
||||
draw_rect(dst, rect.x, rect.y, rect.width, rect.height, color);
|
||||
rect = draw_string(dst, font, string, pos);
|
||||
pos.y -= rect.height - font->height;
|
||||
} break;
|
||||
case UIWidgetKind_Signal: {
|
||||
pos.y -= font->height;
|
||||
Vec4 color = vec4(0, 0, 0, 1);
|
||||
String string = string_fmt(scratch, "%s", w->text);
|
||||
rect = r_get_string_rect(font, string, pos);
|
||||
String string = string_fmt(scratch, "%Q", w->text);
|
||||
rect = get_string_rect(font, string, pos);
|
||||
B32 clicked = ui_mouse_test(ui, w, rect);
|
||||
if (clicked) {
|
||||
w->ptr.signal_callback();
|
||||
@@ -232,8 +232,8 @@ function void ui_end_frame(Bitmap *dst, UI *ui, Font *font) {
|
||||
color = vec4(0.4f, 0.4f, 0.4f, 1.f);
|
||||
}
|
||||
rect.y = rect.y-font->line_advance / 5;
|
||||
r_draw_rect(dst, rect.x, rect.y, rect.width, rect.height, color);
|
||||
rect = r_draw_string(dst, font, string, pos);
|
||||
draw_rect(dst, rect.x, rect.y, rect.width, rect.height, color);
|
||||
rect = draw_string(dst, font, string, pos);
|
||||
pos.y -= rect.height - font->height;
|
||||
} break;
|
||||
invalid_default_case;
|
||||
|
||||
Reference in New Issue
Block a user