I’ve to take care of a uncooked buffer representing some pixels, particularly the pixels crate. To this point I’m able to do some magic from the examples, nevertheless it’s terribly dangerous with regards to readability and I want to convert that buffer right into a 2D array, in an effort to entry it extra effectively and make it simpler for collision detection. So in an effort to draw a single pixel in place (512, 423), I need to do that:
fn draw_something(&mut self) -> /* ... */ {
self.pixel_array_but_2d[512][423] = /* Some shade in hex */;
}
I do know I may do that with different methods with out the conversion to a 2D array, however I nonetheless need to do with the way in which I described.