This commit is contained in:
luboslenco
2025-03-02 21:07:17 +01:00
parent 32bc073574
commit c8a667bfee
59 changed files with 371 additions and 509 deletions
+14 -14
View File
@@ -76,7 +76,7 @@ function main() {
text_handle.text = storage.text;
let ops: kinc_sys_ops_t = {
let ops: kinc_window_options_t = {
title: "ArmorPad",
x: storage.window_x,
y: storage.window_y,
@@ -180,8 +180,8 @@ function list_folder(path: string) {
}
function render() {
storage.window_w = sys_width();
storage.window_h = sys_height();
storage.window_w = kinc_window_width();
storage.window_h = kinc_window_height();
storage.window_x = kinc_window_x();
storage.window_y = kinc_window_y();
if (ui.input_dx != 0 || ui.input_dy != 0) {
@@ -190,7 +190,7 @@ function render() {
ui_begin(ui);
if (ui_window(sidebar_handle, 0, 0, storage.sidebar_w, sys_height(), false)) {
if (ui_window(sidebar_handle, 0, 0, storage.sidebar_w, kinc_window_height(), false)) {
if (storage.project != "") {
list_folder(storage.project);
}
@@ -199,12 +199,12 @@ function render() {
}
}
ui_fill(sys_width() - minimap_w, 0, minimap_w, UI_ELEMENT_H() + UI_ELEMENT_OFFSET() + 1, theme.SEPARATOR_COL);
ui_fill(storage.sidebar_w, 0, 1, sys_height(), theme.SEPARATOR_COL);
ui_fill(kinc_window_width() - minimap_w, 0, minimap_w, UI_ELEMENT_H() + UI_ELEMENT_OFFSET() + 1, theme.SEPARATOR_COL);
ui_fill(storage.sidebar_w, 0, 1, kinc_window_height(), theme.SEPARATOR_COL);
let editor_updated: bool = false;
if (ui_window(editor_handle, storage.sidebar_w + 1, 0, sys_width() - storage.sidebar_w - minimap_w, sys_height(), false)) {
if (ui_window(editor_handle, storage.sidebar_w + 1, 0, kinc_window_width() - storage.sidebar_w - minimap_w, kinc_window_height(), false)) {
editor_updated = true;
let htab: ui_handle_t = ui_handle(__ID__);
let file_name: string = substring(storage.file, string_last_index_of(storage.file, "/") + 1, storage.file.length);
@@ -241,7 +241,7 @@ function render() {
}
// Minimap controls
let minimap_x: i32 = sys_width() - minimap_w;
let minimap_x: i32 = kinc_window_width() - minimap_w;
let minimap_y: i32 = window_header_h + 1;
let redraw: bool = false;
if (ui.input_started && hit_test(ui.input_x, ui.input_y, minimap_x + 5, minimap_y, minimap_w, minimap_h)) {
@@ -312,8 +312,8 @@ function build_project() {
}
function draw_minimap() {
if (minimap_h != sys_height()) {
minimap_h = sys_height();
if (minimap_h != kinc_window_height()) {
minimap_h = kinc_window_height();
if (minimap != null) {
image_unload(minimap);
}
@@ -321,8 +321,8 @@ function draw_minimap() {
}
g2_begin(minimap);
g2_clear(theme.SEPARATOR_COL);
g2_set_color(0xff333333);
g4_clear(theme.SEPARATOR_COL);
draw_set_color(0xff333333);
let lines: string[] = string_split(storage.text, "\n");
let minimap_full_h: i32 = lines.length * 2;
let scroll_progress: f32 = -editor_handle.scroll_offset / (lines.length * UI_ELEMENT_H());
@@ -348,8 +348,8 @@ function draw_minimap() {
// Current position
let visible_area: i32 = out_of_screen > 0 ? minimap_h : minimap_full_h;
g2_set_color(0x11ffffff);
minimap_box_h = math_floor((sys_height() - window_header_h) / UI_ELEMENT_H() * 2);
draw_set_color(0x11ffffff);
minimap_box_h = math_floor((kinc_window_height() - window_header_h) / UI_ELEMENT_H() * 2);
g2_fill_rect(0, scroll_progress * visible_area, minimap_w, minimap_box_h);
g2_end();
}