SFML community forums

General => General discussions => Topic started by: Asmitta on February 21, 2020, 12:59:34 am

Title: GUI with SFML
Post by: Asmitta on February 21, 2020, 12:59:34 am
Good evening first
I want to use textbox in sfml but it seems like it's doesn't exists. I have done researches on it but all the developers who started gui projects for sfml are not working on it again (nuklear, tgui, etc).
Where can i get more tutorials on it? Or can you give me another librairy that where made for gui in sfml ?
Title: Re: GUI with SFML
Post by: eXpl0it3r on February 21, 2020, 08:38:31 am
TGUI is still actively developed. ;)

rubenwardy recently wrote a nice blog post (https://blog.rubenwardy.com/2020/01/21/creating-game-guis-in-sfml/) comparing some of the more popular UI libraries used with SFML.
Title: Re: GUI with SFML
Post by: Asmitta on February 26, 2020, 01:59:55 am
I'm using Nuklear now but i can't insert images...

For TGUI, i'm trying to install it, but it always fail. How can i install it ? I have follow all the instructions ont the website
Title: Re: GUI with SFML
Post by: texus on February 27, 2020, 06:44:18 pm
What fails exactly?
Title: Re: GUI with SFML
Post by: Asmitta on February 28, 2020, 03:10:26 pm
What fails exactly?
My TGUI file doesn't contains the libs folder. The linking is then incomplete
Title: Re: GUI with SFML
Post by: Asmitta on February 28, 2020, 03:35:27 pm
Thanks for the link texus.
But i get another problem. I successfully install tgui now, but when i compile the minimal code given on their website, i have this :
Quote
||=== Build: Debug in TGUI Test (compiler: GNU GCC Compiler) ===|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\Widgets\MenuBar.hpp||In member function 'unsigned int tgui::MenuBar::connectMenuItem(const std::vector<sf::String>&, Func&&, const Args& ...)':|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\Widgets\MenuBar.hpp|165|warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|63|error: expected primary-expression before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|63|error: expected ')' before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|63|error: expected unqualified-id before 'decltype'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|70|error: expected primary-expression before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|70|error: expected ')' before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|70|error: expected unqualified-id before 'decltype'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|77|error: expected primary-expression before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|77|error: expected ')' before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|77|error: expected unqualified-id before 'decltype'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|113|error: expected primary-expression before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|113|error: expected ')' before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|113|error: expected unqualified-id before 'decltype'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|121|error: expected primary-expression before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|121|error: expected ')' before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|121|error: expected unqualified-id before 'decltype'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|147|error: expected primary-expression before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|147|error: expected ')' before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|147|error: expected unqualified-id before 'decltype'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|155|error: expected primary-expression before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|155|error: expected ')' before 'auto'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|155|error: expected unqualified-id before 'decltype'|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp||In member function 'unsigned int tgui::SignalWidgetBase::connect(std::__cxx11::string, Func&&, const Args& ...)':|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|323|warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp||In member function 'unsigned int tgui::SignalWidgetBase::connect(std::__cxx11::string, Func&&, BoundArgs&& ...)':|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalImpl.hpp|333|warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalManagerImpl.hpp||In member function 'unsigned int tgui::SignalManager::connect(std::__cxx11::string, std::__cxx11::string, Func&&, const Args& ...)':|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalManagerImpl.hpp|78|warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalManagerImpl.hpp||In member function 'unsigned int tgui::SignalManager::connect(std::__cxx11::string, std::__cxx11::string, Func&&, BoundArgs&& ...)':|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\SignalManagerImpl.hpp|90|warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14|
C:\Users\Asmitta\Documents\C++Docs\Jeu\TGUI Test\main.cpp|23|warning: 'virtual void tgui::Widget::mouseNoLongerDown()' is deprecated: Use leftMouseButtonNoLongerDown instead [-Wdeprecated-declarations]|
C:\Users\Asmitta\Downloads\TGUI-0.8\include\TGUI\Widget.hpp|659|note: declared here|
||=== Build failed: 21 error(s), 6 warning(s) (0 minute(s), 47 second(s)) ===|
Title: Re: GUI with SFML
Post by: texus on February 28, 2020, 05:55:36 pm
Quote
lambda capture initializers only available with -std=c++14 or -std=gnu++14
You need to add "-std=c++14" to your compiler options in order to use TGUI. Where you do this depends on how you are compiling, but if you are using codeblocks then you can do this in the "Compiler flags" in the "Project build options" as shown in the tutorial (https://tgui.eu/tutorials/0.8/codeblocks/#using-tgui).
Title: Re: GUI with SFML
Post by: Asmitta on February 29, 2020, 07:08:09 pm
I'm using Code::Blocks and in my projects options the c++14 line is checked... :(
Title: Re: GUI with SFML
Post by: texus on February 29, 2020, 10:39:46 pm
Make sure there are no conflicting options checked (e.g. if c++98 is also checked).
There are actually several places where you can set these options. Under "Settings > Compiler..." you can set it globally for all your projects (not recommended). Under "Project > Build options..." you find the settings for your current project. But on the left side of the window you can select whether you are viewing options for Debug, Release of both. So make sure you aren't e.g. only adding the option in release while building your option in debug mode.

Have a look at the build log to see which parameters are passed to g++.
In the build log you can see which options are actually being used. Your error clearly mentions that you don't have c++14 enabled, so either the -std=c++14 option won't appear here or there will also be e.g. some -std=c++98 in the same command that overwrites it.
Title: Re: GUI with SFML
Post by: Asmitta on February 29, 2020, 11:10:46 pm
It is okay now, thanks. I checked stdc++14 in Settings->Compiler...
I can start learning tgui now
Title: Re: GUI with SFML
Post by: Meerjel01 on March 20, 2020, 04:54:12 pm
Random posting.

Someone should make a Grab and Drop program for coders. It could be neat.  :)
Title: Re: GUI with SFML
Post by: binbinhfr on April 22, 2020, 10:31:18 am
you can have a look at Dear IMGUI
https://github.com/ocornut/imgui

that has a SFML backend that is very efficient :
https://github.com/eliasdaler/imgui-sfml