Render states in the gui drawing

Started by Dnake, 07 April 2014, 14:14:40


In my project I need to draw the gui with some render states, and I seen that that's no possible in TGUI v0.6.
So I changed a bit Gui.cpp, and now I can do stuff like this in my project:

Transform transform;
transform.scale(Vector2f(scalingFactor, scalingFactor));
m_gui.draw(true, transform);

But I don't know if you purposely don't implemented this feature. Is that a good idea?
I attached the modified files.


I deliberatly left this option out, because when handing the events, the gui won't know about these states. (read: I once added it but then I noticed that it didn't work so I removed it again)

I haven't looked yet at the changes you made, but when scaling like that you should notice that although the gui gets scaled correctly, the mouse events (e.g. button changing color on mouse hover) will still happen as if the gui wasn't scaled, thus when the mouse is on the wrong position.
Does it actually work with your changes?

What you want is probably to change the view. When passing 'false' to gui.draw and gui.handleEvents, they will use the current view from the window. So if you set the view to twice as small, the gui will appear twice as big.


I suspected that there was a problem, but I couldn't see where  ;D . And that worked because I just used some labels.
I'll look at the views, if I can do what I want with it my project will be much simpler!
Thank you for your fast reply :)