Render frame resize issue

Started by tankhardrive, 23 January 2014, 05:00:35

tankhardrive

So I looked through the tutorials, forum, etc and didn't seem to find anything that answered this. I'm currently rendering my sfml window at 1280 x 720. When you press the fullscreen button I max out the resolution and update the render windows view, which works on everything except my tgui components.

They seem to scale and not resize, button events also no longer work for where they are currently located (mouse over works for their old locations. I was sending true into draw() so the view reset. If i do not pass that it seems to still render in the same location and work correctly. The biggest thing is then if I want the UI to re-position based on the resolution do i need to make another view just for the UI? or what is the correct way / best way to handle this?

tankhardrive

Played around more and looks like if i update the position of each ui component and don't set draw(true) it works correctly. Is there still an easier solution? As my game could have a lot of UI components to do this on (not terrible but would definitely prefer a more hands off solution).

texus

#2
You should use a different view for sfml and tgui if you want to render them differently. Because you want the gui view to change with the resolution, you can't just pass true to the draw function (which is for changing sfml view while keeping the gui view).

So you will have to do something like this:
    set sfml view
    render with sfml

    set view for tgui
    render the gui

How to change the view is something that is explained in the sfml tutorials.

tankhardrive

ah makes sense and easy enough. thanks for the input!