Cleanup
This commit is contained in:
@@ -660,8 +660,6 @@ void ui_draw_tooltip_image() {
|
||||
draw_set_color(0xff000000);
|
||||
draw_filled_rect(current->tooltip_x, current->tooltip_y, w, h);
|
||||
draw_set_color(0xffffffff);
|
||||
current->tooltip_invert_y ?
|
||||
draw_scaled_image(current->tooltip_img, current->tooltip_x, current->tooltip_y + h, w, -h) :
|
||||
draw_scaled_image(current->tooltip_img, current->tooltip_x, current->tooltip_y, w, h);
|
||||
draw_end();
|
||||
}
|
||||
@@ -761,7 +759,6 @@ void ui_draw_combo() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Corner case: current position is the top one according to the search pattern
|
||||
ui_lower_case(str, current->combo_selected_texts->buffer[current->combo_to_submit - step]);
|
||||
if (strstr(str, search) == NULL) {
|
||||
@@ -786,7 +783,6 @@ void ui_draw_combo() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Corner case: current position is the top one according to the search pattern
|
||||
ui_lower_case(str, current->combo_selected_texts->buffer[current->combo_to_submit + step]);
|
||||
if (strstr(str, search) == NULL) {
|
||||
@@ -1330,7 +1326,6 @@ void ui_draw_tabs() {
|
||||
else {
|
||||
tab_x += current->_w + 1;
|
||||
}
|
||||
// ui_draw_rect(true, current->_x + current->button_offset_y, current->_y + current->button_offset_y, current->_w, tab_h); // Round corners
|
||||
draw_filled_rect(current->_x + current->button_offset_y, current->_y + current->button_offset_y, current->_w, tab_h);
|
||||
draw_set_color(theme->TEXT_COL);
|
||||
if (!selected) {
|
||||
@@ -1340,9 +1335,6 @@ void ui_draw_tabs() {
|
||||
|
||||
if (selected) { // Hide underline for active tab
|
||||
if (current->tab_vertical) {
|
||||
// Hide underline
|
||||
// draw_set_color(theme->WINDOW_BG_COL);
|
||||
// draw_filled_rect(current->_x + current->button_offset_y + current->_w - 1, current->_y + current->button_offset_y - 1, 2, tab_h + current->button_offset_y);
|
||||
// Highlight
|
||||
draw_set_color(theme->HIGHLIGHT_COL);
|
||||
draw_filled_rect(current->_x + current->button_offset_y, current->_y + current->button_offset_y - 1, 2, tab_h + current->button_offset_y);
|
||||
@@ -1785,13 +1777,8 @@ bool ui_button(char *text, int align, char *label/*, gpu_texture_t *icon, int sx
|
||||
/*
|
||||
if (icon != NULL) {
|
||||
draw_set_color(0xffffffff);
|
||||
if (current->image_invert_y) {
|
||||
draw_scaled_sub_image(icon, sx, sy, sw, sh, _x + current->button_offset_y, _y - 1 + sh, sw, -sh);
|
||||
}
|
||||
else {
|
||||
draw_scaled_sub_image(icon, sx, sy, sw, sh, _x + current->button_offset_y, _y - 1, sw, sh);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
ui_end_element();
|
||||
@@ -1933,33 +1920,16 @@ int ui_sub_image(gpu_texture_t *image, uint32_t tint, int h, int sx, int sy, int
|
||||
bool released = ui_get_released(h);
|
||||
bool hover = ui_get_hover(h);
|
||||
|
||||
// Limit input to image width
|
||||
// if (current->current_ratio == -1 && (started || down || released || hover)) {
|
||||
// if (current->input_x < current->_window_x + current->_x || current->input_x > current->_window_x + current->_x + w) {
|
||||
// started = down = released = hover = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
draw_set_color(tint);
|
||||
if (!current->enabled) {
|
||||
ui_fade_color(0.25);
|
||||
}
|
||||
if (sw > 0) { // Source rect specified
|
||||
if (current->image_invert_y) {
|
||||
draw_scaled_sub_image(image, sx, sy, sw, sh, x, current->_y + h, w, -h);
|
||||
}
|
||||
else {
|
||||
draw_scaled_sub_image(image, sx, sy, sw, sh, x, current->_y, w, h);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (current->image_invert_y) {
|
||||
draw_scaled_image(image, x, current->_y + h, w, -h);
|
||||
}
|
||||
else {
|
||||
draw_scaled_image(image, x, current->_y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
ui_end_element_of_size(h);
|
||||
return started ? UI_STATE_STARTED : released ? UI_STATE_RELEASED : down ? UI_STATE_DOWN : hover ? UI_STATE_HOVERED : UI_STATE_IDLE;
|
||||
@@ -2135,15 +2105,8 @@ int ui_combo(ui_handle_t *handle, char_ptr_array_t *texts, char *label, bool sho
|
||||
|
||||
int x = current->_x + current->_w - current->arrow_offset_x - 8;
|
||||
int y = current->_y + current->arrow_offset_y + 3;
|
||||
|
||||
draw_set_color(theme->HOVER_COL);
|
||||
// if (handle == current->combo_selected_handle) {
|
||||
// // Flip arrow when combo is open
|
||||
// draw_filled_triangle(x, y, x + UI_ARROW_SIZE(), y, x + UI_ARROW_SIZE() / 2.0, y - UI_ARROW_SIZE() / 2.0);
|
||||
// }
|
||||
// else {
|
||||
draw_filled_triangle(x, y, x + UI_ARROW_SIZE(), y, x + UI_ARROW_SIZE() / 2.0, y + UI_ARROW_SIZE() / 2.0);
|
||||
// }
|
||||
|
||||
if (show_label && label[0] != '\0') {
|
||||
if (align == UI_ALIGN_LEFT) {
|
||||
@@ -2279,7 +2242,6 @@ void ui_tooltip(char *text) {
|
||||
void ui_tooltip_image(gpu_texture_t *image, int max_width) {
|
||||
current->tooltip_img = image;
|
||||
current->tooltip_img_max_width = max_width;
|
||||
current->tooltip_invert_y = current->image_invert_y;
|
||||
current->tooltip_y = current->_y + current->_window_y;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,6 @@ typedef struct ui {
|
||||
bool is_hovered;
|
||||
bool is_released;
|
||||
bool changed; // Global elements change check
|
||||
bool image_invert_y;
|
||||
bool scroll_enabled;
|
||||
bool always_redraw; // Hurts performance
|
||||
bool highlight_on_select; // Highlight text edit contents on selection
|
||||
@@ -245,7 +244,6 @@ typedef struct ui {
|
||||
char tooltip_text[512];
|
||||
gpu_texture_t *tooltip_img;
|
||||
int tooltip_img_max_width;
|
||||
bool tooltip_invert_y;
|
||||
float tooltip_x;
|
||||
float tooltip_y;
|
||||
bool tooltip_shown;
|
||||
|
||||
@@ -806,7 +806,6 @@ declare type ui_t = {
|
||||
submit_text_handle: ui_handle_t;
|
||||
combo_selected_handle: ui_handle_t;
|
||||
current_ratio: i32;
|
||||
image_invert_y: bool;
|
||||
elements_baked: bool;
|
||||
window_border_right: i32;
|
||||
window_border_top: i32;
|
||||
|
||||
Reference in New Issue
Block a user