From aa1e52dc442c0c539df2a80b5498071e3a56f90b Mon Sep 17 00:00:00 2001 From: Kimon Papahadjopoulos Date: Sat, 6 Jan 2024 18:02:54 -0800 Subject: [PATCH] update readme --- Dioxus.toml | 2 +- README.md | 31 ++++++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Dioxus.toml b/Dioxus.toml index 9b682dd..c563e3a 100644 --- a/Dioxus.toml +++ b/Dioxus.toml @@ -6,7 +6,7 @@ name = "game_of_life" # default platfrom # you can also use `dx serve/build --platform XXX` to use other platform # value: web | desktop -default_platform = "web" +default_platform = "desktop" # Web `build` & `serve` dist path out_dir = "dist" diff --git a/README.md b/README.md index 669029a..60686a0 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,29 @@ With the Dioxus framework the code is 100% Rust. Game of Life +## Versions + +* 1.x: Works on web only, uses canvas for rendering +* 2.x: Works on web or desktop, uses SVG for rendering + ## Demonstrates -* A Dioxus web app written completely in Rust. +* A Dioxus web/desktop app written completely in Rust. * Frame animation using `request_animation_frame()` and abstracting to a Dioxus `use_state` hook. * Limited by the frame rate of the monitor. * A FramesPerSecond component that displays the current frames per second. -* Building a component from a 2d HTML canvas. -* Using using Dioxus' onmount event to get an element (similar to react's use_ref) +* Version 1.x + * Building a component from a 2d HTML canvas. + * Using using Dioxus' onmount event to get an element (similar to react's use_ref) +* Version 2.x + * How to create a Dioxus app that works with both desktop and web + * Use use_eval() to get access to the DOM + * Don't use canvas (svg instead) + * Access to precise system time + * Generating random numbers + * Use of SVG to draw grid and cells + * Use view_port to set coordinate systems to simplify coding + * Cell grid's units are pixels + * Create a grid using patterns with major and minor grid lines ## Install and run * Install the rust development environment: https://www.rust-lang.org/tools/install @@ -22,8 +38,13 @@ With the Dioxus framework the code is 100% Rust. * Install the wasm target for rust: `rustup target add wasm32-unknown-unknown` * clone this repository: `git clone https://github.com/kimonp/dioxus-game-of-life.git` * `cd dioxus-game-of-life` -* Run in debug mode with the dioxus cli: `dx serve --platform=web` -* Point your browser at: http://localhost:8080 +* Version 2.0: + * Desktop: `dx serve --platform=desktop --featues=desktop` + * Web: `dx serve --platform=web --featues=web` + * Point your browser at: http://localhost:8080 +* Version 1.0 + * Run in debug mode with the dioxus cli: `dx serve --platform=web` + * Point your browser at: http://localhost:8080 ## Methodology Defines a `GameOfLifeGrid` component that renders the game of life (with several control buttons),