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.
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use std::error::Error;
|
||||
|
||||
slint::include_modules!();
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
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()
|
||||
}
|
|
@ -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 {
|
||||
in-out property <int> 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 <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