SFML community forums
Help => Graphics => Topic started by: jdogg2727 on March 12, 2017, 06:53:01 pm
-
So I looked around for a good way to basically attach something to a view, but I couldn't find any great solutions.
Right now I'm trying to draw a tool box with text and images over top the rest of my editor for I can see information without it looking like a mess. Each frame the view moves I have to reset the position of the tool box, each image, and each text object.
if(*view moves*){
*update positioning for each object* //I don't want this step :(
...
...
}
draw(*object*)
...
...
Is there a way I can simply "attach" these to the view? Or would I maybe be better off drawing each of these to an image, positioning the image and then drawing that?
-
Just use another view that doesn't change.
-
That would be the way i'd do it aswel. In my case I've created 2 views: The GameView (For seeing the world) and a UIView. The UI view I use to draw non-world related UI elements (i.e. UI elements that shouldn't be attached to a specific in-world object).
To switch between views you can use the window.setView() function:
http://www.sfml-dev.org/documentation/2.4.2/classsf_1_1RenderTarget.php#a063db6dd0a14913504af30e50cb6d946