I am using the ggez library to create a simple pong game.
My code on the line of error:
let racket = graphics::Rect::new(10.0, 10.0, 300.0, 150.0);
let racket_mesh = graphics::Mesh::new_rectangle(ctx, graphics::DrawMode::fill(), racket, graphics::WHITE);
graphics::draw(ctx, &racket_mesh, graphics::DrawParam::default());
the error:
28 | graphics::draw(ctx, &racket_mesh, graphics::DrawParam::default());
| ^^^^^^^^^^^^^^ the trait `Drawable` is not implemented for `Result<Mesh, GameError>`
Edit:
it worked after adding ?
at the end of the line like:
let racket_mesh = graphics::Mesh::new_rectangle(ctx, graphics::DrawMode::fill(), racket, graphics::WHITE,)?;
also adding a comma after the last element (weird coming from different languages)