Add egui demo to REAMDE

This commit is contained in:
2024-04-15 20:13:47 -05:00
parent 641eb3a5f3
commit f54922e1e1
2 changed files with 9 additions and 4 deletions

View File

@@ -58,3 +58,7 @@ This is an experimental repository while testing a Rust + SDL2 project built wit
- Advanced Emscripten bindings for Javascript (fetch, GET/POST)
- No Asyncify, uses `emscripten_set_main_loop` callback instead.
- See the [REST functions](https://github.com/aelred/tetris/blob/master/tetris/src/rest.rs#L99) for Emscripten.
- [coderedart/rust-sdl2-wasm](https://github.com/coderedart/rust-sdl2-wasm/tree/master)
- This is mostly interesting because it has an egui implementation; egui is very cool for demos, developer tooling, debug menus, and so on.
- The only thing I don't understand is where SDL2 is; there is almost no real code referencing SDL2 except a `SDL2Backend` provided by the `egui` crate. Weird.
- While devoid of anything particularly interesting for my own needs, it has a demo [here](https://coderedart.github.io/rust-sdl2-wasm/)

View File

@@ -77,9 +77,10 @@ fn main() {
let mut prev = now();
let font_data = RWops::from_bytes(FONT_DATA).unwrap();
let font_size = 12;
let font = ttf_ctx.load_font_from_rwops(font_data, font_size).unwrap();
// let font_data = RWops::from_bytes(FONT_DATA).unwrap();
// let font_size = 12;
// let font = ttf_ctx.load_font_from_rwops(font_data, font_size).unwrap();
let font = ttf_ctx.load_font("./assets/TerminalVector.ttf", 12).unwrap();
let fruit_atlas = texture_creator
.load_texture("./assets/fruit.png")