Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / Gosu's transform features
- - By Maverick Date 2012-02-02 06:09 Edited 2012-02-02 15:41
I'm not fully sure how to use Gosu's transform methods (C++) such as Gosu::scale() and all that. Any help?
Parent - - By lol_o2 Date 2012-02-02 09:13
Like that:
window.scale(scale_x,scale_y) do
  #drawing code
Parent - - By Maverick Date 2012-02-02 15:41
Sorry. I forgot to mention in C++ Gosu.
Parent - - By erisdiscord Date 2012-02-02 20:42
The C++ methods scale, rotate etc. return a transformation matrix (Gosu::Transform, actually an array of double). You actually want to call Graphics::pushTransform(const Transform&) to apply a transformation, then Graphics::popTransform() when you're done with it.

You can also create arbitrary transformations like skew IIRC, but I'm not an expert on matrix maths.

As implied by the names push and pop, transformations stack, so don't forget to pop everything you push.
Parent - - By Maverick Date 2012-02-03 04:43
I did that and I received no results which is why I posed the question. I believed it looked like this:


I can go back and check tomorrow, but I'm pretty certain that's exactly what I did. Thanks though.
Parent - By jlnr (dev) Date 2012-02-03 07:37
Your code is correct and I am using this in "production" (Terava), but it's been refactored recently. Let me know if you can reproduce this problem in a simple test setup.
Up Topic Gosu / Gosu Exchange / Gosu's transform features

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill