Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - texus

Pages: 1 [2] 3 4 ... 92
16
General Discussion / Re: Re-using RenderWindow
« on: 02 May 2019, 18:38:19 »
If you really want then I could give you an example code that uses 2 windows (e.g. if you want to show the setup window while the main window is still displayed in the background), but creating a new sf::RenderWindow is always going to take some time (creating a new window is simply slow operation, it isn't related to SFML). Maybe if you make the window invisible instead of closing it, the second time you open the settings could be faster, but the first time will always be relatively slow.
I recommend doing it with just a single window and having only a single main loop.

17
General Discussion / Re: Re-using RenderWindow
« on: 02 May 2019, 18:10:58 »
Is there anything that prevents you from just keeping the window and gui and just calling gui.removeAllWidgets() and adding the widgets for the next screen?
Multiple screens could be prepared upfront by creating a Group widget per screen (and adding the widgets to the group instead of to the gui). Then showing another screen is as simple as calling group1->setVisible(false); group2->setVisible(true);

Or maybe use a tgui::ChildWindow instead of an actual window?

18
General Discussion / Re: Re-using RenderWindow
« on: 30 April 2019, 15:57:19 »
tgui::Gui just keeps a pointer to the RenderWindow, it will not destroy the window when the Gui gets destroyed. You only have to make sure not to call functions on the Gui object after the window it uses has been destroyed.

Why do you need a second sf::RenderWindow? Can't you just continue to use the existing window? If you really need a second window then you also need a second Gui that renders to that window.

19
Installation help / Re: Cannot install TGUI as STATIC library
« on: 30 April 2019, 15:04:29 »
SFML_ROOT is for SFML < 2.5. You should pass -DSFML_DIR=... to cmake instead.
Maybe you could also try without having the dynamic libraries on your system and see what happens. Finding the dynamic libraries might be e.g. hide that it is looking in the wrong place.

20
Help requests / Re: MessageBox how to use
« on: 26 April 2019, 18:56:33 »
The connectable signals of a widget are currently listed under "Public Attributes" in the documentation. E.g. for MessageBox: https://tgui.eu/documentation/0.8/classtgui_1_1MessageBox.html#pub-attribs
(I am aware that you might not search them there and that you have to know where to look before you can find them)

MessageBox has a "ButtonPressed" signal which has the text of the pressed button as optional parameter, so you would have something like this:
messageBox->connect("ButtonPressed", [&retVal](const std::string& button){
    if (button == "OK")
        retVal = 0;
    else if (button == "Cancel")
        retVal = 1;
});

21
Installation help / Re: Cannot install TGUI as STATIC library
« on: 26 April 2019, 17:53:15 »
That option has to be set to FALSE, but it should be done in cmake (either by unchecking it in the gui or by specifying -DTGUI_SHARED_LIBS=FALSE at the command line). If that option is TRUE then you are building dynamic tgui libraries (which will obviously link to dynamic sfml libraries).

22
Installation help / Re: Cannot install TGUI as STATIC library
« on: 25 April 2019, 17:54:51 »
How did you check which libraries TGUI depends on (to exclude that you are linking to the dynamic libraries yourself, and more importantly so that I can try it here)?

TGUI is supposed to always link in the same way as SFML unless you manually specify otherwise. Did you change some cmake flags? Are you adding defines other than SFML_STATIC in your project?

23
Feature requests / Re: tgui::Gui setting background color
« on: 21 April 2019, 18:08:24 »
The background color of all rendering is chosen in the window.clear() call. If you want a red background behind everything then you can just do window.clear(sf::Color::Red).
If the gui only fills part of the screen and you want to give it a different color then you can just add a Panel to the gui and add your widgets to the panel.

24
General Discussion / Re: gui-builder form file decoding
« on: 14 April 2019, 11:39:37 »
You can use the get function which takes the name of the widget as parameter:
tgui::Widget::Ptr widget = gui.get("name"); // Without template you get the Widget base class (for when you don't need functions specific to the widget type)
tgui::Button::Ptr button = gui.get<tgui::Button>("name"); // With template you can get an object of the right type

25
Help requests / Re: TextBox, Button and Functions.
« on: 13 April 2019, 19:44:28 »
The merhaba function takes 2 parameter, neither of which the Button should provide (i.e. the last parameter isn't a string that should contain the caption of the button), so you have to provide both parameters to the connect function:
button->connect("pressed", &merhaba, std::ref(window), i);

The "i" value will however be copied, so the merhaba function will always be called with the same value.
If you want to get the value of the edit box at the moment you press the button then you should pass "yazialani" instead of "i" to the connect function (and change merhaba to take a tgui::EditBox::Ptr as second parameter) and put the "int i = std::atoi(yazialani->getText().toAnsiString().c_str());" at the start of the merhaba function.

26
Feature requests / Re: Theme constructor
« on: 12 April 2019, 18:36:54 »
I'm the sole developer. Some people have contributed some pieces of code but most comes from just me.

Quote
we could prevent users to tamper with the theme
Personally I don't think we should prevent people from tampering with resources if they want to change things. But loading from memory can of course have its use cases other than preventing tampering so it might still a useful feature.

One problem with loading from memory is how to handle external resources. If you just want to load the theme file from memory and let the images still be loaded from files then it isn't difficult but you probably want textures to be loaded from memory as well. I'm not sure how that should be done.

Technically it is already possible with tgui to load themes without using filenames, but that is probably too much work to be useful. You could make a class that inherits from BaseThemeLoader (like the DefaultThemeLoader does) and call the static Theme::setThemeLoader function to change the loader. Then the THEME_BLACK could be defined as the string "1000" and the custom theme loader would implement a way to load the right theme based on that id.
But the way you load things from memory is probably too specific to your code to be used by others, otherwise someone would have to write it once and it could be shipped with TGUI as alternative to the DefaultThemeLoader.

27
General Discussion / Re: gui-builder form file decoding
« on: 12 April 2019, 18:21:18 »
The Gui class and any container widget have a loadWidgetsFromFile function where you can pass the filename (and a loadWidgetsFromStream function in case you want to load it from memory).

28
Installation help / Re: Cannot install TGUI as STATIC library
« on: 09 April 2019, 19:09:56 »
I didn't notice earlier that your last error was after the TGUI library was already build. Try disabling TGUI_BUILD_GUI_BUILDER when building TGUI. In the cmake gui uncheck the option or in the command line pass -DTGUI_BUILD_GUI_BUILDER=FALSE
This might be a problem with how the gui builder is linked.

Update:
I just tested it here and I also get these errors when TGUI_BUILD_GUI_BUILDER is on (default). I'll look into it.
Disabling the TGUI_BUILD_GUI_BUILDER fixes the issue.

Update 2:
I figured out why the gui-builder is giving these undefined reference errors.

SFML radically changed their cmake script in SFML 2.5 but in order to remain compatible with older SFML versions I added a compatibility layer. Since SFML_DIR is not defined, TGUI is using it's own way to find SFML which was apparently broken for static linking. This has now been fixed in the latest version on github.

However it turns out that if the compatibility layer isn't used (by setting SFML_DIR to /usr/local/lib/cmake/SFML/ or wherever SFML is installed), it will give undefined references to GLX functions instead. I had to manually link to GLX to build statically. This does look like an issue with SFML itself. I'll try to investigate it further in the next few days.

29
Installation help / Re: Cannot install TGUI as STATIC library
« on: 09 April 2019, 19:01:02 »
Quote
I managed to install TGUI as Dynamic Library on my Raspberry PI 386 Debian Linux.
Did you encounter any issues in doing this? It's been a few years since I tested TGUI on a Respberry Pi, so I'm interested to hear whether or not it still works without manual changes.

Quote
In the long run it creates a lot of support issues.
What kind of problems would you expect? I know it is possible to bundle the .so files with the application. It takes a lot of experimenting and you missed a file which causes it to break on newer linux systems several years later then you just need to ship that extra file. But I would consider the issues with .so files more on a short term, once you figure out how to do it properly it should continue to work on newer systems.

I've never build statically on linux so I can't help much. How did you get the other .a files? I'm not sure if they are all going to be compatible with each other when you download some random versions, but building them yourself is probably too difficult.

XRRQueryVersion and XRRGetScreenResources are part of the xrandr library. So maybe you have an incompatible libxrandr.a file or something?

I don't think this is specific to TGUI, if you reproduce it with only SFML then maybe you could ask it on their forum. Hopefully someone on the SFML forum would be able to help you further. You should try to make your own simple cmake project (which only uses SFML and not TGUI) and see if the issue still occurs, e.g. something like this:
cmake_minimum_required(VERSION 3.5)
project(CMake-test)

add_executable(Test main.cpp)

set(SFML_STATIC_LIBRARIES TRUE)
find_package(SFML 2 COMPONENTS graphics window system REQUIRED)
target_link_libraries(Test PRIVATE sfml-graphics)

30
Help requests / Re: button->connect member functions
« on: 24 March 2019, 17:09:47 »
The parameters for generateRW don't match, in the connect function you pass one parameter too much, the m_ebChanceStartAlive.

The generateCA line looks fine, assuming the edit boxes are declared like this in the App class:
tgui::EditBox::Ptr m_ebNumSimulationSteps;

Can you show the full errors you get on the m_buttonGenerateCA->connect call?

Pages: 1 [2] 3 4 ... 92