calref/cboe

Does not build with recent TGUI

Closed this issue · 4 comments

x-qq commented

TGUI 0.9 has introduced some breaking changes, our code will need to be adapted to them.

build/obj/game/boe.menu.cpp:200:52: error: cannot convert ‘const sf::String’ to ‘const tgui::String&’
  200 |         return this->tgui.get<tgui::MenuBar>(this->internal_menubar_widget_name);
      |                                              ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                    |
      |                                                    const sf::String
build/obj/game/boe.menu.cpp:238:30: error: ‘using element_type = class tgui::MenuBar’ {aka ‘class tgui::MenuBar’} has no member named ‘disconnect’
  238 |                 if(!menubar->disconnect(connection_id))
      |                              ^~~~~~~~~~

and possibly more.

Unfortunately, it still does not build. Is there a chance it would work with TGUI v0.8?

x-qq commented

It should build using TGUI 0.8.7 without issues.

Well, I managed to partially build it using TGUI 0.8.7 - I got some binaries but the process finished with some errors in the end. After some wandering through the menu, the game crashed. It might have been caused by aforementioned issues though.

I use ArchLinux on x64 platform, the build was done using the command:
scons INCLUDEPATH=/home/szymek/repos/TGUI/include/ LIBPATH=/home/szymek/repos/TGUI/build/lib/
and I needed to add the line:
#include <memory>
to the file src/tools/winutil.hpp .

Looks like a lot of the errors with 0.9.x are because TGUI added their own String class. This change is written about here: https://tgui.eu/tutorials/0.9/strings/

It says an implicit conversion exists:

TGUI was required to have its own string class, but I wanted to hide it as much as possible. So whether you are using char*, whar_t*, char8_t* char16_t*, char32_t*, std::string, std::wstring, std::u8string, std::u16string, std::u32string or sf::String, there is an implicit constructor for it.

So the solution might be to simply include tgui::String to fix all these type errors.