This is a simple wrapper around Pixels, designed to be used with Buffer Graphics Lib
In your Cargo.toml
file add
toml
pixels-graphics-lib = "0.11.6"
winit_input_helper_temp = "0.14.2" #only needed if you're not using `run()`
You can use scenes using run_scenes
:
```rust
fn main() -> Result<()> {
// Window prefs allow the size and position of the window to be saved and restored
let windowprefs = WindowPreferences::new("com", "example", "app")?;
// Options contains scaling, UPS, etc
let options = Options::default();
// The switcher is how new scenes are created
let switcher: SceneSwitcher
// The scene name is the id used so the switcher knows which one to create
enum SceneName { Example, }
// After a scene is finished it can return values to it's parent using scene result
enum SceneResult {}
struct ExampleScene {}
impl ExampleScene {
pub fn new() -> Box
impl Scene
fn update(
&mut self,
timing: &Timing,
mouse_xy: Coord,
held_keys: &Vec<&VirtualKeyCode>,
) -> SceneUpdateResult<SceneResult, SceneName> {
todo!()
}
fn resuming(&mut self, result: Option<SceneResult>) {
todo!()
}
} ```
or a more low level with run
```rust
struct Example {}
fn main() -> Result<()> { let system = Box::new(Example {}); run(240, 160, "Example", Box::new(system), Options::default())?; Ok(()) }
//Check src/scenes.rs
for examples of implementing held keys, etc
impl System for Example {
fn update(&mut self, timing: &Timing) {}
fn render(&mut self, graphics: &mut Graphics) {}
}
```
window_prefs
Save and restore window position and size
To use this the impl System
must override System::window_prefs()
A few retro games
Editor for IndexedImage
Test GUI for USFX