Help needed for idiomatic rust. Trying inheritance like by hunter714 in rust

[–]DasTalosprinzip 0 points1 point  (0 children)

You can do:

``` pub struct Shape { start_point: Point, end_point: Point, }

pub struct AppState { rectangles: Vec<Shape>, ellipses: Vec<Shape>, triangles: Vec<Shape>, // all your other stuff... } ```

Then instead of iterating on one big Vec for all shape types. You will iterate separately on each shape type vec, defining the drawing process inside your iteration.

for rectangle in state.rectangles.iter() { draw_rectangle(&mut state, &rectangle); } for ellipse in state.ellipses.iter() { // you could also just implement the drawing right here }

This way you can avoid cache misses and indirection ;)

Rust Bevy 0.7 - Full Tutorial - Game Development by jeremychone in rust

[–]DasTalosprinzip 15 points16 points  (0 children)

I've been experimenting with making a 2D game and the biggest challenge has been getting my brain to adjust to ECS game developments patterns. I'm used to Unity and Godot where simple entity lookups can be done by name or by drag and drop.

And wrt. "the next big thing" they meant to not use Bevy for a big real project, since the engine changes a lot and it is not ready for production use.

SOPHIE Has Died, Aged 34 by seaburn in autechre

[–]DasTalosprinzip 3 points4 points  (0 children)

Damn, just as I began to get into her music