https://github.com/andrie/bouncing-ball-rs
Animation of a bouncing ball, written in Rust, using eframe and egui. See the live demo at https://andrie.github.io/bouncing-ball-rs/
https://github.com/andrie/bouncing-ball-rs
Last synced: about 1 month ago
JSON representation
Animation of a bouncing ball, written in Rust, using eframe and egui. See the live demo at https://andrie.github.io/bouncing-ball-rs/
- Host: GitHub
- URL: https://github.com/andrie/bouncing-ball-rs
- Owner: andrie
- Created: 2023-01-22T15:24:16.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-08-16T20:21:12.000Z (almost 2 years ago)
- Last Synced: 2025-02-14T13:16:52.821Z (3 months ago)
- Language: Rust
- Homepage:
- Size: 620 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bouncing ball
### Testing locally
Make sure you are using the latest version of stable rust by running `rustup update`.
`cargo run --release`
On Linux you need to first run:
`sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev`
On Fedora Rawhide you need to run:
`dnf install clang clang-devel clang-tools-extra speech-dispatcher-devel libxkbcommon-devel pkg-config openssl-devel libxcb-devel fontconfig-devel`
On Windows install the VS-Code build tools from (the free one is enough).
### Web Locally
You can compile your app to [WASM](https://en.wikipedia.org/wiki/WebAssembly) and publish it as a web page.
Install the wasm target with
``` bash
rustup target add wasm32-unknown-unknown
```We use [Trunk](https://trunkrs.dev/) to build for web target.
1. Install Trunk with `cargo install --locked trunk`.
2. Run `trunk serve` to build and serve on `http://127.0.0.1:8080`. Trunk will rebuild automatically if you edit the project.
3. Open `http://127.0.0.1:8080/index.html#dev` in a browser. See the warning below.> `assets/sw.js` script will try to cache our app, and loads the cached version when it cannot connect to server allowing your app to work offline (like PWA).
> appending `#dev` to `index.html` will skip this caching, allowing us to load the latest builds during development.### Web Deploy
1. Just run `trunk build --release`.
2. It will generate a `dist` directory as a "static html" website
3. Upload the `dist` directory to any of the numerous free hosting websites including [GitHub Pages](https://docs.github.com/en/free-pro-team@latest/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site).
4. we already provide a workflow that auto-deploys our app to GitHub pages if you enable it.
> To enable Github Pages, you need to go to Repository -> Settings -> Pages -> Source -> set to `gh-pages` branch and `/` (root).
>
> If `gh-pages` is not available in `Source`, just create and push a branch called `gh-pages` and it should be available.You can test the template app at .
## Updating egui
As of 2022, egui is in active development with frequent releases with breaking changes. [bouncing_ball](https://github.com/emilk/bouncing_ball/) will be updated in lock-step to always use the latest version of egui.
When updating `egui` and `eframe` it is recommended you do so one version at the time, and read about the changes in [the egui changelog](https://github.com/emilk/egui/blob/master/CHANGELOG.md) and [eframe changelog](https://github.com/emilk/egui/blob/master/crates/eframe/CHANGELOG.md).