Initial commit
This commit is contained in:
commit
447b36e8c9
4 changed files with 3903 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
/target
|
||||||
3872
Cargo.lock
generated
Normal file
3872
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
9
Cargo.toml
Normal file
9
Cargo.toml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
[package]
|
||||||
|
name = "phantasma"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
winit = "0.30.9"
|
||||||
|
masonry = { git = "https://github.com/linebender/xilem.git", version = "0.2.0" }
|
||||||
|
xilem = { git = "https://github.com/linebender/xilem.git", version = "0.1.0" }
|
||||||
21
src/main.rs
Normal file
21
src/main.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
use winit::error::EventLoopError;
|
||||||
|
use xilem::view::{button, flex, label};
|
||||||
|
use xilem::{EventLoop, WidgetView, Xilem};
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct Counter {
|
||||||
|
num: i32,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn app_logic(data: &mut Counter) -> impl WidgetView<Counter> {
|
||||||
|
flex((
|
||||||
|
label(format!("{}", data.num)),
|
||||||
|
button("increment", |data: &mut Counter| data.num += 1),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() -> Result<(), EventLoopError> {
|
||||||
|
let app = Xilem::new(Counter::default(), app_logic);
|
||||||
|
app.run_windowed(EventLoop::with_user_event(), "Counter app".into())?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue