diff --git a/src/Tools/tim_tool/src/main.rs b/src/Tools/tim_tool/src/main.rs index d065a6de..bf454cd4 100644 --- a/src/Tools/tim_tool/src/main.rs +++ b/src/Tools/tim_tool/src/main.rs @@ -1,22 +1,10 @@ // Prevent console window in addition to Slint window in Windows release builds when, e.g., starting the app via file manager. Ignored on other platforms. #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] -use std::error::Error; - slint::include_modules!(); -fn main() -> Result<(), Box> { - let ui = AppWindow::new()?; +fn main() -> Result<(), slint::PlatformError> { + let main_window = MainWindow::new()?; - ui.on_request_increase_value({ - let ui_handle = ui.as_weak(); - move || { - let ui = ui_handle.unwrap(); - ui.set_counter(ui.get_counter() + 1); - } - }); - - ui.run()?; - - Ok(()) -} + main_window.run() +} \ No newline at end of file diff --git a/src/Tools/tim_tool/ui/app-window.slint b/src/Tools/tim_tool/ui/app-window.slint index a2cb9238..1b1b7399 100644 --- a/src/Tools/tim_tool/ui/app-window.slint +++ b/src/Tools/tim_tool/ui/app-window.slint @@ -1,19 +1,38 @@ -import { Button, VerticalBox } from "std-widgets.slint"; +component VRAMSegment inherits Rectangle { + in property area_overlap_width; + in property area_overlap_height; -export component AppWindow inherits Window { - in-out property counter: 42; - callback request-increase-value(); - VerticalBox { - Text { - text: "Counter: \{root.counter}"; - } + width: 64px; + height: 256px; + background: #37f560; - Button { - checked: false; - text: "Increase value"; - clicked => { - root.request-increase-value(); - } - } + Rectangle { + x: 0px; + y: 0px; + width: area_overlap_width > 64 ? 64px : area_overlap_width*1px; + height: area_overlap_height > 256 ? 256px : area_overlap_height*1px; + background: #d7e609; } } + +component VRAMArea inherits Rectangle { + in property display_area_width; + in property display_area_height; + + for idx in 16 : VRAMSegment { + x: mod(idx,8)*(64+1)*1px; + y: floor(idx/8)*(256+1)*1px; + + area_overlap_width: parent.display_area_width - (mod(idx,8)*64); + area_overlap_height: parent.display_area_height - (256*floor(idx/8)); + } +} + +export component MainWindow inherits Window { + VRAMArea { + x: 0; + y: 0; + display_area_width: 32+64+3; + display_area_height: 256+128; + } +} \ No newline at end of file