*

Dnake

  • *
  • 29
    • View Profile
Render states in the gui drawing
« on: 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:
Code: [Select]
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.

*

texus

  • *****
  • 1151
    • View Profile
    • Texus's Blog
Re: Render states in the gui drawing
« Reply #1 on: 07 April 2014, 14:20:49 »
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.

*

Dnake

  • *
  • 29
    • View Profile
Re: Render states in the gui drawing
« Reply #2 on: 07 April 2014, 14:35:35 »
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 :)