Resizing Window Skews Buttons

Started by Strikerklm96, 07 April 2016, 05:46:54

Strikerklm96

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.
Code (cpp) Select

//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

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.

Strikerklm96

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

Strikerklm96

Wow, so a lot has changed. What is the new equivalent of bindCallbackEx ?

texus

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

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.

Strikerklm96

That's probably what I will do. Using old code feels scary now  :'(

Strikerklm96

Awesome, everything works! I saw that parameter, but stupidly concluded I needed to pass in true to do what I wanted instead of false.