Skip to content

Latest commit

 

History

History

zscene

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

zscene

zscene is a simple scene and declarative animation manager.

Made for Zemeroth game. Historically was part of Häte crate.

This crate provides:

  • Sprites that can be shared
  • Scene and Actions to manipulate it
  • Basic layers

Examples

The following code sample shows how to create sprite, add it to the scene and move it:

let mut sprite = Sprite::from_path(context, "/fire.png", 0.5)?;
sprite.set_pos(Vec2::new(0.0, -1.0));
let delta = Vector2::new(0.0, 1.5);
let time = Duration::from_millis(2_000);
let action = action::Sequence::new(vec![
    action::Show::new(&self.layers.fg, &sprite).boxed(), // show the sprite
    action::MoveBy::new(&sprite, delta, time).boxed(), // move it
]);
self.scene.add_action(action.boxed());

See examples/action.rs for a complete example:

cargo run -p zscene --example action