More progress

This commit is contained in:
jaby 2025-01-26 22:46:41 +00:00
parent 9a80b17e0b
commit 57a76bbe27
4 changed files with 100 additions and 57 deletions

View File

@ -1,62 +1,26 @@
component VRAMSegment inherits Rectangle { import { MainTab } from "./main-tab.slint";
in property <image> img; import { FileTab } from "./file-tab.slint";
in property <int> clip_x; import { TabWidget } from "std-widgets.slint";
in property <int> clip_y;
width: 64px;
height: 256px;
clip: true;
Image {
source: img;
x: -root.clip_x*1px;
y: -root.clip_y*1px;
}
}
component VRAMArea inherits Rectangle {
in property <image> img;
in property <int> img_x;
in property <int> img_y;
width: (64*16+15)*1px;
height: (256*2+1)*1px;
for idx in 32 : VRAMSegment {
x: root.get_x(idx)*(64px + 1px);
y: root.get_y(idx)*(256px + 1px);
img: img;
clip_x: (root.get_x(idx)*64) - root.img_x;
clip_y: (root.get_y(idx)*256) - root.img_y;
}
function get_x(idx: int) -> int {
return mod(idx, 16);
}
function get_y(idx: int) -> int {
return floor(idx/16);
}
}
export component MainWindow inherits Window { export component MainWindow inherits Window {
min-width: 1024px; min-width: vram_tab.width;
min-height: 640px; min-height: vram_tab.height;
VRAMArea { TabWidget {
x: 0px; current-index: 1;
y: 0px; file_tab := Tab {
img: @image-url("../../../../examples/PoolBox/assets/AllTheJaby.png"); title: "File Bah" + root.min-width/1px;
img_x: 0; FileTab {
img_y: 0; x: 0px;
background: #0365f796; y: 0px;
} }
VRAMArea { }
x: 0px; vram_tab := Tab {
y: 0px; title: "VRAM Layout";
img: @image-url("../../../../examples/PoolBox/assets/IMG_6921.png"); MainTab {
img_x: 80; x: 0px;
img_y: 80; y: 0px;
background: #ff000076; }
}
} }
} }

View File

@ -0,0 +1,3 @@
export component FileTab inherits Rectangle {
}

View File

@ -0,0 +1,36 @@
import { VRAMArea } from "./vram-components.slint";
import { GroupBox } from "std-widgets.slint";
export component MainTab inherits Rectangle {
width: group.width;
height: group.height;
group := GroupBox {
title: "VRAM Layout";
x: 4px;
y: 4px;
VerticalLayout {
Rectangle {
width: background_image.width + 8px;
height: background_image.height + 8px;
border-width: 4px;
border-color: black;
background_image := VRAMArea {
x: 4px;
y: 4px;
img: @image-url("../../../../examples/PoolBox/assets/AllTheJaby.png");
img_x: 0;
img_y: 0;
}
// Extend these from input some how
VRAMArea {
x: 4px;
y: 4px;
img: @image-url("../../../../examples/PoolBox/assets/IMG_6921.png");
img_x: 80;
img_y: 80;
}
}
}
}
}

View File

@ -0,0 +1,40 @@
component VRAMSegment inherits Rectangle {
in property <image> img;
in property <int> clip_x;
in property <int> clip_y;
width: 64px;
height: 256px;
clip: true;
Image {
source: img;
x: -root.clip_x*1px;
y: -root.clip_y*1px;
}
}
export component VRAMArea inherits Rectangle {
in property <image> img;
in property <int> img_x;
in property <int> img_y;
width: (64*16+15)*1px;
height: (256*2+1)*1px;
for idx in 32 : VRAMSegment {
x: root.get_x(idx)*(64px + 1px);
y: root.get_y(idx)*(256px + 1px);
img: img;
clip_x: (root.get_x(idx)*64) - root.img_x;
clip_y: (root.get_y(idx)*256) - root.img_y;
}
function get_x(idx: int) -> int {
return mod(idx, 16);
}
function get_y(idx: int) -> int {
return floor(idx/16);
}
}