2024-03-14 15:31:22 +01:00
|
|
|
|
2024-09-03 15:52:05 +02:00
|
|
|
function tab_console_draw(htab: ui_handle_t) {
|
2024-03-14 15:31:22 +01:00
|
|
|
let title: string = console_message_timer > 0 ? console_message + " " : tr("Console");
|
|
|
|
|
let color: i32 = console_message_timer > 0 ? console_message_color : -1;
|
|
|
|
|
|
|
|
|
|
let statush: i32 = config_raw.layout[layout_size_t.STATUS_H];
|
2025-09-16 15:03:51 +02:00
|
|
|
if (ui_tab(htab, title, false, color) && statush > ui_statusbar_default_h * UI_SCALE()) {
|
2024-03-14 15:31:22 +01:00
|
|
|
|
2024-09-03 15:52:05 +02:00
|
|
|
ui_begin_sticky();
|
2024-09-06 21:11:46 +02:00
|
|
|
///if (arm_windows || arm_linux || arm_macos) // Copy
|
2024-03-14 15:31:22 +01:00
|
|
|
if (config_raw.touch_ui) {
|
2024-04-25 22:04:43 +02:00
|
|
|
let row: f32[] = [1 / 4, 1 / 4, 1 / 4];
|
2024-09-03 15:52:05 +02:00
|
|
|
ui_row(row);
|
2024-03-14 15:31:22 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2024-04-25 22:04:43 +02:00
|
|
|
let row: f32[] = [1 / 14, 1 / 14, 1 / 14];
|
2024-09-03 15:52:05 +02:00
|
|
|
ui_row(row);
|
2024-03-14 15:31:22 +01:00
|
|
|
}
|
|
|
|
|
///else
|
|
|
|
|
if (config_raw.touch_ui) {
|
2024-04-25 22:04:43 +02:00
|
|
|
let row: f32[] = [1 / 4, 1 / 4];
|
2024-09-03 15:52:05 +02:00
|
|
|
ui_row(row);
|
2024-03-14 15:31:22 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2024-04-25 22:04:43 +02:00
|
|
|
let row: f32[] = [1 / 14, 1 / 14];
|
2024-09-03 15:52:05 +02:00
|
|
|
ui_row(row);
|
2024-03-14 15:31:22 +01:00
|
|
|
}
|
|
|
|
|
///end
|
|
|
|
|
|
2024-09-03 15:52:05 +02:00
|
|
|
if (ui_button(tr("Clear"))) {
|
2024-03-14 15:31:22 +01:00
|
|
|
console_last_traces = [];
|
|
|
|
|
}
|
2024-09-03 15:52:05 +02:00
|
|
|
if (ui_button(tr("Export"))) {
|
2024-03-20 16:13:54 +01:00
|
|
|
ui_files_show("txt", true, false, function (path: string) {
|
2024-05-03 21:29:39 +02:00
|
|
|
let str: string = string_array_join(console_last_traces, "\n");
|
2024-03-14 15:31:22 +01:00
|
|
|
let f: string = ui_files_filename;
|
2024-03-20 16:13:54 +01:00
|
|
|
if (f == "") {
|
|
|
|
|
f = tr("untitled");
|
|
|
|
|
}
|
2024-03-14 15:31:22 +01:00
|
|
|
path = path + path_sep + f;
|
2024-03-20 16:13:54 +01:00
|
|
|
if (!ends_with(path, ".txt")) {
|
|
|
|
|
path += ".txt";
|
|
|
|
|
}
|
2024-09-03 16:39:16 +02:00
|
|
|
iron_file_save_bytes(path, sys_string_to_buffer(str), 0);
|
2024-03-14 15:31:22 +01:00
|
|
|
});
|
|
|
|
|
}
|
2024-09-06 21:11:46 +02:00
|
|
|
///if (arm_windows || arm_linux || arm_macos)
|
2024-09-03 15:52:05 +02:00
|
|
|
if (ui_button(tr("Copy"))) {
|
2024-05-03 21:29:39 +02:00
|
|
|
let str: string = string_array_join(console_last_traces, "\n");
|
2025-03-09 17:02:12 +01:00
|
|
|
iron_copy_to_clipboard(str);
|
2024-03-14 15:31:22 +01:00
|
|
|
}
|
|
|
|
|
///end
|
|
|
|
|
|
2024-09-03 15:52:05 +02:00
|
|
|
ui_end_sticky();
|
2024-03-14 15:31:22 +01:00
|
|
|
|
2025-03-02 21:07:17 +01:00
|
|
|
let _font: draw_font_t = ui.ops.font;
|
2024-11-08 23:46:39 +01:00
|
|
|
let _font_size: i32 = ui.font_size;
|
2025-03-02 21:07:17 +01:00
|
|
|
let f: draw_font_t = data_get_font("font_mono.ttf");
|
2025-08-31 19:23:47 +02:00
|
|
|
ui_set_font(ui, f);
|
2025-08-15 22:04:07 +02:00
|
|
|
ui.font_size = math_floor(15 * UI_SCALE());
|
2024-03-21 21:06:41 +01:00
|
|
|
for (let i: i32 = 0; i < console_last_traces.length; ++i) {
|
|
|
|
|
let t: string = console_last_traces[i];
|
2024-09-03 15:52:05 +02:00
|
|
|
ui_text(t);
|
2024-03-14 15:31:22 +01:00
|
|
|
}
|
2025-08-31 19:23:47 +02:00
|
|
|
ui_set_font(ui, _font);
|
2024-11-08 23:46:39 +01:00
|
|
|
ui.font_size = _font_size;
|
2024-03-14 15:31:22 +01:00
|
|
|
}
|
|
|
|
|
}
|