Resizing Window Skews Buttons
« on: 07 April 2016, 05:46:54 »
When resizing the window, the buttons become squished, as you can image. However, resetting the windows view before drawing them does not fix it, and resetting the gui window doesn't either.
//doesnt fix it
theResizedWindow.setView(recalculatedDefaultView);
gui.draw()

//doesnt fix it
gui.setWindow(theResizedWindow);
 
I also tried both at once.
Should these work, or is there something else I need to be doing?

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Resizing Window Skews Buttons
« Reply #1 on: 07 April 2016, 10:45:25 »
The gui has its own view, theResizedWindow.setView will only affect your own sfml drawing.
You have to call gui.setView(recalculatedDefaultView) is you want tgui to take the new view into account as well.

Re: Resizing Window Skews Buttons
« Reply #2 on: 07 April 2016, 19:07:53 »
Hmm, I don't seem to have that function, and gui.getWindow()->setView(view) doesn't work either :/ Guess I gotta go grab the latest.  :P

Re: Resizing Window Skews Buttons
« Reply #3 on: 07 April 2016, 19:22:11 »
Wow, so a lot has changed. What is the new equivalent of bindCallbackEx ?

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Resizing Window Skews Buttons
« Reply #4 on: 07 April 2016, 20:02:27 »
If you have to change a lot of code then you could perhaps better stay with v0.6 because you will have to rewrite practically everything to move to v0.7.

The closest equivalent to bindCallbackEx would be the connectEx function, but that function only exists because the normal connect function requires a good compiler for complex bindings. If you want to learn how the new callback system works you can start by reading the introduction tutorial.

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Resizing Window Skews Buttons
« Reply #5 on: 07 April 2016, 20:07:30 »
It is so long ago that I used tgui 0.6 myself that I completely forgot how the view worked in that version.

If you decide to stay with 0.6 then instead of calling gui.setView you have to pass "false" as extra parameter to both gui.draw in gui.handleEvents to fix your problem.

Re: Resizing Window Skews Buttons
« Reply #6 on: 07 April 2016, 20:38:25 »
That's probably what I will do. Using old code feels scary now  :'(

Re: Resizing Window Skews Buttons
« Reply #7 on: 07 April 2016, 21:02:06 »
Awesome, everything works! I saw that parameter, but stupidly concluded I needed to pass in true to do what I wanted instead of false.