QuantumBadger / Speedy2D

Rust library for hardware accelerated drawing of 2D shapes, images, and text, with an easy to use API.
Apache License 2.0
381 stars 41 forks source link

Consider exposing window size from Graphics2D #76

Closed matklad closed 1 year ago

matklad commented 1 year ago

When drawing onto a resizable window, it's useful to know the current window size. Right now, I get it by storing the current size in my Handler and updating it on on_draw, but it would perhaps be more natural to have something like

impl Graphics2D {
    fn size(&self) -> Vec2;
}

Just so that one doesn't need to think about converting between integral pixels and float coordinates graphics is using for most stuff.

dennisorlando commented 1 year ago

Would #78 be a solution? It's not attached directly to Graphics2D but to the WindowHelper that gets passed with the draw() methods

matklad commented 1 year ago

Yup!

QuantumBadger commented 1 year ago

Now merged, thank you @dennisorlando!