Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: GUI with SFML  (Read 8254 times)

0 Members and 1 Guest are viewing this topic.

Asmitta

  • Newbie
  • *
  • Posts: 6
    • View Profile
GUI with SFML
« 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 ?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: GUI with SFML
« Reply #1 on: February 21, 2020, 08:38:31 am »
TGUI is still actively developed. ;)

rubenwardy recently wrote a nice blog post comparing some of the more popular UI libraries used with SFML.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Asmitta

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: GUI with SFML
« Reply #2 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

texus

  • Sr. Member
  • ****
  • Posts: 499
    • View Profile
    • TGUI
    • Email
Re: GUI with SFML
« Reply #3 on: February 27, 2020, 06:44:18 pm »
What fails exactly?
TGUI: C++ SFML GUI

Asmitta

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: GUI with SFML
« Reply #4 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
« Last Edit: February 28, 2020, 03:12:56 pm by Asmitta »

Asmitta

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: GUI with SFML
« Reply #5 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)) ===|

texus

  • Sr. Member
  • ****
  • Posts: 499
    • View Profile
    • TGUI
    • Email
Re: GUI with SFML
« Reply #6 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).
TGUI: C++ SFML GUI

Asmitta

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: GUI with SFML
« Reply #7 on: February 29, 2020, 07:08:09 pm »
I'm using Code::Blocks and in my projects options the c++14 line is checked... :(

texus

  • Sr. Member
  • ****
  • Posts: 499
    • View Profile
    • TGUI
    • Email
Re: GUI with SFML
« Reply #8 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.
TGUI: C++ SFML GUI

Asmitta

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: GUI with SFML
« Reply #9 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

Meerjel01

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: GUI with SFML
« Reply #10 on: March 20, 2020, 04:54:12 pm »
Random posting.

Someone should make a Grab and Drop program for coders. It could be neat.  :)

binbinhfr

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: GUI with SFML
« Reply #11 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