There are five things you need to change in your code to get tgui working.
The first thing to do is including it. TGUI will include “SFML/Graphics.hpp” for you.
The next thing to do is creating the gui.
Since sfml no longer provides a default font, you will have to set your own font.
When you will have widgets, they will need to receive events. Otherwise they wouldn’t know if your mouse is on top of them or not. Every time you receive an event, you will have to tell the gui about this event. So in your event loop you must add the following line:
The last thing to do is drawing the widgets on the screen. For this you must call the draw function of the gui. All widgets will be drawn on the screen in the order that you created them. So if your widgets overlap each other then the last created widget will be drawn in front.