Sketch-out VRAM-Area
This commit is contained in:
parent
9549d011b8
commit
93ac49f2c5
|
@ -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.
|
// 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")]
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||||
|
|
||||||
use std::error::Error;
|
|
||||||
|
|
||||||
slint::include_modules!();
|
slint::include_modules!();
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn Error>> {
|
fn main() -> Result<(), slint::PlatformError> {
|
||||||
let ui = AppWindow::new()?;
|
let main_window = MainWindow::new()?;
|
||||||
|
|
||||||
ui.on_request_increase_value({
|
main_window.run()
|
||||||
let ui_handle = ui.as_weak();
|
}
|
||||||
move || {
|
|
||||||
let ui = ui_handle.unwrap();
|
|
||||||
ui.set_counter(ui.get_counter() + 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ui.run()?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
|
@ -1,19 +1,38 @@
|
||||||
import { Button, VerticalBox } from "std-widgets.slint";
|
component VRAMSegment inherits Rectangle {
|
||||||
|
in property <int> area_overlap_width;
|
||||||
|
in property <int> area_overlap_height;
|
||||||
|
|
||||||
export component AppWindow inherits Window {
|
width: 64px;
|
||||||
in-out property <int> counter: 42;
|
height: 256px;
|
||||||
callback request-increase-value();
|
background: #37f560;
|
||||||
VerticalBox {
|
|
||||||
Text {
|
|
||||||
text: "Counter: \{root.counter}";
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
Rectangle {
|
||||||
checked: false;
|
x: 0px;
|
||||||
text: "Increase value";
|
y: 0px;
|
||||||
clicked => {
|
width: area_overlap_width > 64 ? 64px : area_overlap_width*1px;
|
||||||
root.request-increase-value();
|
height: area_overlap_height > 256 ? 256px : area_overlap_height*1px;
|
||||||
}
|
background: #d7e609;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component VRAMArea inherits Rectangle {
|
||||||
|
in property <int> display_area_width;
|
||||||
|
in property <int> 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue