aboutsummaryrefslogtreecommitdiff
path: root/resource-viewer
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2023-10-27 22:58:12 +0300
committerValentin Popov <valentin@popov.link>2023-10-27 22:58:12 +0300
commit9708d731992be2f24cfd229a28eedf642a8dee0f (patch)
tree5bc5f13a2f24ebf5b083fda10e38a6b4f127ba7e /resource-viewer
parenta97d68b0e18a0002636b497264adab4744572f49 (diff)
downloadfparkan-9708d731992be2f24cfd229a28eedf642a8dee0f.tar.xz
fparkan-9708d731992be2f24cfd229a28eedf642a8dee0f.zip
Init of the game resource viewer
Diffstat (limited to 'resource-viewer')
-rw-r--r--resource-viewer/Cargo.toml11
-rw-r--r--resource-viewer/build.rs3
-rw-r--r--resource-viewer/src/main.rs13
-rw-r--r--resource-viewer/ui/appwindow.slint17
4 files changed, 44 insertions, 0 deletions
diff --git a/resource-viewer/Cargo.toml b/resource-viewer/Cargo.toml
new file mode 100644
index 0000000..2e95506
--- /dev/null
+++ b/resource-viewer/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "resource-viewer"
+version = "0.1.0"
+edition = "2021"
+build = "build.rs"
+
+[dependencies]
+slint = "1.0"
+
+[build-dependencies]
+slint-build = "1.0"
diff --git a/resource-viewer/build.rs b/resource-viewer/build.rs
new file mode 100644
index 0000000..0a2d8aa
--- /dev/null
+++ b/resource-viewer/build.rs
@@ -0,0 +1,3 @@
+fn main() {
+ slint_build::compile("ui/appwindow.slint").unwrap();
+}
diff --git a/resource-viewer/src/main.rs b/resource-viewer/src/main.rs
new file mode 100644
index 0000000..4fa6b9f
--- /dev/null
+++ b/resource-viewer/src/main.rs
@@ -0,0 +1,13 @@
+slint::include_modules!();
+
+fn main() -> Result<(), slint::PlatformError> {
+ let ui = AppWindow::new()?;
+
+ let ui_handle = ui.as_weak();
+ ui.on_request_increase_value(move || {
+ let ui = ui_handle.unwrap();
+ ui.set_counter(ui.get_counter() + 1);
+ });
+
+ ui.run()
+}
diff --git a/resource-viewer/ui/appwindow.slint b/resource-viewer/ui/appwindow.slint
new file mode 100644
index 0000000..4862c47
--- /dev/null
+++ b/resource-viewer/ui/appwindow.slint
@@ -0,0 +1,17 @@
+import { Button, VerticalBox } from "std-widgets.slint";
+
+export component AppWindow inherits Window {
+ in-out property<int> counter: 42;
+ callback request-increase-value();
+ VerticalBox {
+ Text {
+ text: "Counter: \{root.counter}";
+ }
+ Button {
+ text: "Increase value";
+ clicked => {
+ root.request-increase-value();
+ }
+ }
+ }
+} \ No newline at end of file