Support proper background and coordinates now
This commit is contained in:
@@ -4,12 +4,14 @@ import { MainTab } from "./tab/main-tab.slint";
|
||||
import { TabWidget } from "std-widgets.slint";
|
||||
|
||||
export component MainWindow inherits Window {
|
||||
in-out property main_tab_vram_file_list <=> tab.vram_files;
|
||||
in-out property main_tab_vram_images <=> tab.vram_images;
|
||||
// Main Tab values
|
||||
in-out property main_tab_vram_bg <=> main_tab.vram_bg;
|
||||
in-out property main_tab_vram_file_list <=> main_tab.vram_files;
|
||||
in-out property main_tab_vram_images <=> main_tab.vram_images;
|
||||
|
||||
callback main_tab_add_file_clicked <=> tab.add_file_clicked;
|
||||
callback main_tab_remove_file_clicked <=> tab.remove_file_clicked;
|
||||
callback move_vram_image <=> tab.move_vram_image;
|
||||
callback main_tab_add_file_clicked <=> main_tab.add_file_clicked;
|
||||
callback main_tab_remove_file_clicked <=> main_tab.remove_file_clicked;
|
||||
callback move_vram_image <=> main_tab.move_vram_image;
|
||||
|
||||
title: "TIM Tool 0.1.0";
|
||||
width: tab_widget.width;
|
||||
@@ -18,8 +20,8 @@ export component MainWindow inherits Window {
|
||||
tab_widget := TabWidget {
|
||||
x: 0px;
|
||||
y: 0px;
|
||||
width: tab.width;
|
||||
height: tab.height;
|
||||
width: main_tab.width;
|
||||
height: main_tab.height;
|
||||
|
||||
current-index: 1;
|
||||
Tab {
|
||||
@@ -31,7 +33,7 @@ export component MainWindow inherits Window {
|
||||
}
|
||||
Tab {
|
||||
title: "VRAM Layout";
|
||||
tab := MainTab {
|
||||
main_tab := MainTab {
|
||||
x: 0px;
|
||||
y: 0px;
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ struct VRAMImage {
|
||||
}
|
||||
|
||||
export component MainTab inherits Rectangle {
|
||||
in-out property <image> vram_bg;
|
||||
in-out property <[StandardListViewItem]> vram_files: [];
|
||||
in-out property <[VRAMImage]> vram_images: [];
|
||||
|
||||
@@ -31,16 +32,16 @@ export component MainTab inherits Rectangle {
|
||||
border-color: #404040;
|
||||
background: #A0A0A0;
|
||||
background_image := VRAMArea {
|
||||
x: root.get_border_width()*1px;
|
||||
y: root.get_border_width()*1px;
|
||||
img: @image-url("../../../../../examples/PoolBox/assets/AllTheJaby.png");
|
||||
x: root.get_border_width()*1px;
|
||||
y: root.get_border_width()*1px;
|
||||
img: vram_bg;
|
||||
img_x: 0;
|
||||
img_y: 0;
|
||||
}
|
||||
|
||||
for vram_image[i] in root.vram_images: VRAMArea {
|
||||
x: root.get_border_width()*1px;
|
||||
y: root.get_border_width()*1px;
|
||||
x: root.get_border_width()*1px;
|
||||
y: root.get_border_width()*1px;
|
||||
img: vram-image.img;
|
||||
img_x: vram-image.x;
|
||||
img_y: vram-image.y;
|
||||
@@ -53,12 +54,18 @@ export component MainTab inherits Rectangle {
|
||||
moved => {
|
||||
self.mouse-cursor = MouseCursor.grabbing;
|
||||
root.move_vram_image(i, (self.mouse-x - self.pressed-x)/1px, (self.mouse-y - self.pressed-y)/1px);
|
||||
|
||||
cur_sel_x.display_value = parent.img_x;
|
||||
cur_sel_y.display_value = parent.img_y;
|
||||
}
|
||||
pointer-event(event) => {
|
||||
if event.kind == PointerEventKind.up {
|
||||
self.mouse-cursor = MouseCursor.grab;
|
||||
}
|
||||
|
||||
if event.kind == PointerEventKind.down {
|
||||
cur_sel_x.display_value = parent.img_x;
|
||||
cur_sel_y.display_value = parent.img_y;
|
||||
}
|
||||
}
|
||||
|
||||
// Thanks to Cody the white tiger
|
||||
@@ -117,6 +124,14 @@ export component MainTab inherits Rectangle {
|
||||
height: 128px;
|
||||
background: #A0A0A0;
|
||||
}
|
||||
cur_sel_x := Text {
|
||||
in-out property <int> display_value;
|
||||
text: "X: " + display_value;
|
||||
}
|
||||
cur_sel_y :=Text {
|
||||
in-out property <int> display_value;
|
||||
text: "Y: " + display_value;
|
||||
}
|
||||
ComboBox {
|
||||
model: ["4-bit", "16-bit", "24-bit"];
|
||||
current-value: "4-bit";
|
||||
|
Reference in New Issue
Block a user