I cannot figure out how to use the macroquad::experimental::animation::AnimatedSprite, I tried doing this:
let player_walking_anim = macroquad::experimental::animation::AnimatedSprite {
tile_width: 32.0,
tile_height: 32.0,
animations: (&[macroquad::experimental::animation::Animation {
name: "spritesheet.png".to_string(),
row: 1,
frames: 10,
fps: 15,
}]).to_vec(),
playing: true,
};
But the compiler returns this error: error: cannot construct `AnimatedSprite` with struct literal syntax due to inaccessible fields
I cannot find any documentation on this struct anywhere. And the compiler's --explain
is not being very helpful:
if "Not a bool" {
Erroneous code examples: `bool`, found `&str`
}
fn plus_one(x: i32) -> i32 {
x + 1- ^^^^^^^^^^^^^ expected `f32`, found `&str`
}/ |
// expected due to this
plus_one("Not a number");
// ^^^^^^^^^^^^^^ expected `i32`, found `&str`
This error occurs when an expression was used in a place where the compiler
if "Not a bool" {
// ^^^^^^^^^^^^ expected `bool`, found `&str`
}
let x: f32 = "Not a float";
// --- ^^^^^^^^^^^^^ expected `f32`, found `&str`
// |
// expected due to this
This error occurs when an expression was used in a place where the compiler
expected an expression of a different type. It can occur in several cases, the
most common being when calling a function and passing an argument which has a
different type than the matching type in the function declaration. ```