2022-12-16 10:55:20 +00:00
|
|
|
#![allow(non_snake_case)]
|
|
|
|
|
2022-03-05 21:10:17 +00:00
|
|
|
use dioxus::prelude::*;
|
2022-09-13 23:22:27 +00:00
|
|
|
use dioxus_desktop::{tao::dpi::LogicalSize, Config, WindowBuilder};
|
2022-12-16 10:55:20 +00:00
|
|
|
use dioxus_router::prelude::*;
|
2022-03-04 18:08:25 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
env_logger::init();
|
|
|
|
|
2022-09-13 23:22:27 +00:00
|
|
|
let cfg = Config::new().with_window(
|
|
|
|
WindowBuilder::new()
|
|
|
|
.with_inner_size(LogicalSize::new(600, 1000))
|
|
|
|
.with_resizable(false),
|
|
|
|
);
|
|
|
|
|
|
|
|
dioxus_desktop::launch_cfg(app, cfg)
|
2022-03-04 18:08:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn app(cx: Scope) -> Element {
|
2023-06-02 17:33:47 +00:00
|
|
|
render! {
|
|
|
|
Router {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Routable, Clone)]
|
|
|
|
#[rustfmt::skip]
|
|
|
|
enum Route {
|
|
|
|
#[layout(Footer)]
|
|
|
|
#[route("/")]
|
|
|
|
Home {},
|
|
|
|
#[route("/games")]
|
|
|
|
Games {},
|
|
|
|
#[route("/play")]
|
|
|
|
Play {},
|
|
|
|
#[route("/settings")]
|
|
|
|
Settings {},
|
|
|
|
}
|
2022-12-16 10:55:20 +00:00
|
|
|
|
2023-06-02 17:33:47 +00:00
|
|
|
#[inline_props]
|
|
|
|
fn Footer(cx: Scope) -> Element {
|
2022-12-16 10:55:20 +00:00
|
|
|
render! {
|
2022-12-17 06:39:27 +00:00
|
|
|
div {
|
2022-12-17 18:02:26 +00:00
|
|
|
Outlet { }
|
2022-12-16 10:55:20 +00:00
|
|
|
|
2022-12-17 18:02:26 +00:00
|
|
|
p {
|
|
|
|
"----"
|
|
|
|
}
|
2022-12-16 10:55:20 +00:00
|
|
|
|
2022-12-17 18:02:26 +00:00
|
|
|
nav {
|
|
|
|
ul {
|
2023-06-02 17:33:47 +00:00
|
|
|
li { Link { target: Route::Home {}, "Home" } }
|
|
|
|
li { Link { target: Route::Games {}, "Games" } }
|
|
|
|
li { Link { target: Route::Play {}, "Play" } }
|
|
|
|
li { Link { target: Route::Settings {}, "Settings" } }
|
2022-03-04 18:08:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-12-16 10:55:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-02 17:33:47 +00:00
|
|
|
#[inline_props]
|
2022-12-16 10:55:20 +00:00
|
|
|
fn Home(cx: Scope) -> Element {
|
|
|
|
render!("Home")
|
|
|
|
}
|
|
|
|
|
2023-06-02 17:33:47 +00:00
|
|
|
#[inline_props]
|
2022-12-16 10:55:20 +00:00
|
|
|
fn Games(cx: Scope) -> Element {
|
|
|
|
render!("Games")
|
|
|
|
}
|
|
|
|
|
2023-06-02 17:33:47 +00:00
|
|
|
#[inline_props]
|
2022-12-16 10:55:20 +00:00
|
|
|
fn Play(cx: Scope) -> Element {
|
|
|
|
render!("Play")
|
|
|
|
}
|
|
|
|
|
2023-06-02 17:33:47 +00:00
|
|
|
#[inline_props]
|
2022-12-16 10:55:20 +00:00
|
|
|
fn Settings(cx: Scope) -> Element {
|
|
|
|
render!("Settings")
|
2022-03-04 18:08:25 +00:00
|
|
|
}
|