QuantumBadger / Speedy2D

Rust library for hardware accelerated drawing of 2D shapes, images, and text, with an easy to use API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider exposing window size from Graphics2D

matklad opened this issue · comments

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.

commented

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

Yup!

Now merged, thank you @dennisorlando!