Temp fix for _g2_current handling

This commit is contained in:
luboslenco
2025-01-04 19:58:42 +01:00
parent 4e7294bc47
commit 18733ab49e
3 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -1651,7 +1651,7 @@ bool ui_window_dirty(ui_handle_t *handle, int x, int y, int w, int h) {
return current->always_redraw || current->is_scrolling || input_changed;
}
bool ui_window(ui_handle_t *handle, int x, int y, int w, int h, bool drag) {
bool _ui_window(ui_handle_t *handle, int x, int y, int w, int h, bool drag) {
if (handle->texture.width == 0 || w != handle->texture.width || h != handle->texture.height) {
ui_resize(handle, w, h);
}
+1 -1
View File
@@ -265,7 +265,7 @@ void ui_begin_sticky();
void ui_end_sticky();
void ui_begin_region(ui_t *ui, int x, int y, int w);
void ui_end_region(bool last);
bool ui_window(ui_handle_t *handle, int x, int y, int w, int h, bool drag); // Returns true if redraw is needed
bool _ui_window(ui_handle_t *handle, int x, int y, int w, int h, bool drag); // Returns true if redraw is needed
bool ui_button(char *text, int align, char *label);
int ui_text(char *text, int align, int bg);
bool ui_tab(ui_handle_t *handle, char *text, bool vertical, uint32_t color);
+7 -1
View File
@@ -140,6 +140,12 @@ function _ui_tooltip_image(image: image_t, max_width: i32 = 0) {
}
}
function ui_window(handle: ui_handle_t, x: i32, y: i32, w: i32, h: i32, drag: bool = false): bool {
_g2_current = { render_target_: ADDRESS(handle.texture) };
_g2_in_use = true;
return _ui_window(handle, x, y, w, h, drag);
}
function _ui_set_scale(ui: ui_t, factor: f32) {
let current: ui_t = ui_get_current();
ui_set_current(ui);
@@ -271,7 +277,7 @@ declare function ui_tooltip_image(tex: any, max_width: i32 = 0): void;
declare function ui_tooltip_render_target(rt: any, max_width: i32 = 0): void;
declare function ui_separator(h: i32 = 4, fill: bool = true): void;
declare function ui_text_area(handle: ui_handle_t, align: ui_align_t = ui_align_t.LEFT, editable: bool = true, label: string = "", word_wrap: bool = false): string;
declare function ui_window(handle: ui_handle_t, x: i32, y: i32, w: i32, h: i32, drag: bool = false): bool;
declare function _ui_window(handle: ui_handle_t, x: i32, y: i32, w: i32, h: i32, drag: bool = false): bool;
declare function ui_begin(ui: ui_t): void;
declare function ui_end(last: bool = true): void;
declare function ui_end_window(bind_global_g: bool = true): void;