Main Menu
Menu

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.

Show posts Menu

Messages - Garwin

#26
Help requests / Re: Compiling time
01 May 2022, 09:44:22
Issue is that this information is not included in the builder log (enclosed).

I check all the project setting, no issues find (debug version).

Compiler flags:
-std=c++17
-static-staticlibgcc-static-libstdc++
-g
-Wall

Defines:
SFML_STATIC
TGUI_STATIC


Linker settings:
tgui-s-d
sfml-graphics-s-d
sfml-window-s-d
sfml-system-s-d
opengl32
freetype
winmm
gdi32

Search directories (compiler):
...\project itself\include
...\SFML\include
...\TGUI\include

Search directories (linker):
same - only instead include there is lib

Custom variables:




Another strange thing is that the file is too large, going from about 10 MB to over 50 MB.
Everything is fast except final "rows" from output file.


EDIT:
changing to dynamic linking makin the compiling only 3 seconds and 6 MB file size. So it seems that it really must compile whole TGUI library, but I cannot see what setting did it.
#27
Help requests / Compiling time
01 May 2022, 02:39:46
Finally adding TGUI code to my first game.
However, I am quite surprised that it change compiling time significantly.

Before adding TGUI, it takes 3-4 seconds to compile.
After adding just declaration of tgui to one of my classes:

#include <TGUI/Core.hpp>
#include <TGUI/Backend/SFML-Graphics.hpp>
#include <TGUI/Widgets/Button.hpp>

tgui::Gui m_gui;


And the compilation time increased to 79 seconds even with commenting out all other TGUI staff.
Is it OK such increase of compilation time? Especially with the notes below?

note1: Codeblock GCC 7.3.0
static linking of SFML and TGUI

note2: for my previous testing I used dynamic linking of SFML and TGUI and it takes only 3 seconds to compile.
#28
Thanks for the reply and ideas. I will think about it as, there are really several options.
#29
I am in the middle of the first simple game and start thinking about something more complex.

I am still thinking about how to merge TGUI which I would like to use for GUI and game graphics itself. I have some ideas however I do not know if there are good ones so some feedback is welcome.

1. Use TGUI as the base graphical engine and use canvas for drawing the game itself
I can see some advantages and disadvantages:
advantages:
- as the canvas is defined, everything inside can be drawn there and can have a separate handling
disadvantages:
- having canvas as fullscreen and GUI as widget over it seems more difficult, bat probably achievable?

2. Game graphic integrate with TGUI as widgets
advantages:
- can use features of TGUI having same theme (eg. tooltips, rightclick menu etc.)
disadvantages:
- quite complex to make widget for graphic entities and unknown if this is possible and reasonable
#30
Help requests / Edit box - key ENTER pressed
18 April 2022, 12:09:13
I find out that if the Edit box is active (cursor blinks) and ENTER is pressed, it does not unfocus Editbox / does not end editing. The only possible way is to click by mouse somewhere else.
It is quite strange as I look into code of the widget and  there is:

    void EditBox::keyPressed(const Event::KeyEvent& event)
    {
        if (event.code == Event::KeyboardKey::Enter)
        {
            onReturnKeyPress.emit(this, m_text);
            onReturnOrUnfocus.emit(this, m_text);
        }


However I cannot find "emit" anywhere (implementation).


OS: Windows 10
Codeblock 20.03
MinGW 7.3.0
SFML 2.5.1
TGUI 0.1 beta - MinGW 64 version
- both libraries linked dynamically
#31
Installation help / Re: Codeblock and TGUI
13 April 2022, 14:36:11
It would help a lot as the API is quite large and it seems to use it effectively means understanding it under the hood.
#32
Installation help / Re: Codeblock and TGUI
13 April 2022, 10:08:45
Thanks, I did try std::ref but did not realize the bad order.

Nice library, a little more difficult to understand for a beginner like me compared to SFML which has really easy syntax, but has a lot of functionality and it seems some functionality can be used over SFML objects (needs to dig in how).


Just a question. Is there anywhere just simple overview of all widgets?
Something like list of widget with simple screenshot or at least just list of widgets?

I look at tutorial and examples, there a listed many of them but it seems there is no place where there is list of all of them.
So far, I can see:
- tabs / tabs container
- menu bar (clickable and rollable options)
- label  (just text)
- radio button (for the first look it seems  that primary it is single button, clickable, need to look if it can be unclicked)
- button (seems similar to radio button except visualization)
- edit box (need to check, how it treats longer strings than
- list box (with options and scrollable, need to find if this scroll on right can be removed)
- progress bar
- slider
- combo box (to choose from options)
- child window
- chat box
- canvas (it seems interesing as it seems to me that it can draw SFML sprites and use TGUI functionality. I will dig into it)
- scrollable panel
#33
Installation help / Re: Codeblock and TGUI
13 April 2022, 07:45:47
Thanks, it is even better limiting to parent, not the whole window.


I am now experimenting with callback event in the code trying to use example of https://tgui.eu/tutorials/0.10/signals/ but I struggle.

This is callback:
popupMenu->onItemSelect(&popupMenuCallback1);

and function:

double popupMenuCallback1(tgui::String item)
{
}


But I need to pass reference of variable "speed" as this variable will be change in accordance to choosen item. I use example and try to pass value (even trying pointer) with errors.
I was thinking about lambdas (still trying to undertand them) but I need not to pass only variable but use of choosen item from listbox too.

This is callback:
popupMenu->onItemSelect(&popupMenuCallback1, speed);

and function:

double popupMenuCallback1(tgui::String item, double& speed)
{
}

#34
Installation help / Re: Codeblock and TGUI
12 April 2022, 17:20:44
Code included. And sorry, it is not tooltip, it is context menu from example mentioned above.
Just do not look at quality of code, it is just a mess trying everything and some part of code is from my first testing c++.

Just thinking how can I get choosen context menu back to main (generally back to caller to work with it).
Another thoughts how to implement tooltip over SFML objects, not only TGUI widgets using advantage of one theme in future.

#35
Installation help / Re: Codeblock and TGUI
12 April 2022, 16:48:32
Quote from: texus on 12 April 2022, 16:39:26
QuoteJust an idea moving position of tooltip up/left by difference between bounding box of last entry in relation to videomode.
I'm not sure what you mean. It should already be moving the tool tip if it would be outside the window. Isn't it behaving like that for you?

No, it is not. See screenshot.

#36
Installation help / Re: Codeblock and TGUI
12 April 2022, 15:32:33
Finally it works. Thanks a lot for your time.

Somehow changing of linking of SFML libraries from static to dynamic was not saved.
Saved now and it works like a charm.

I will start to look what library is offering.


Tooltips seems very nice.  Just an idea moving position of tooltip up/left by difference between bounding box of last entry in relation to videomode.
#37
Installation help / Re: Codeblock and TGUI
12 April 2022, 15:03:28
Interesting thing is that I found out that I have:
g++ (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Strange that opening Codeblock shows gcc 8.1.0. but it seems more likely that it is MinGW 8.1.0
#38
Installation help / Re: Codeblock and TGUI
12 April 2022, 14:42:29
It seems I will need to learn how to compile libraries. Finaly run, but except background there is nothing and right click shows some problem with OpenGL.

Text from console running program.

An internal OpenGL call failed in RenderTarget.cpp(302).
Expression:
   glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Vertex), data + 8)
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.

An internal OpenGL call failed in RenderTarget.cpp(711).
Expression:
   glDrawArrays(mode, static_cast<GLint>(firstVertex), static_cast<GLsizei>(vertexCount))
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.
#39
Installation help / Re: Codeblock and TGUI
12 April 2022, 13:57:14
Thanks, it helps.

I rename other changes but there is still one error I have not found the reason.

    tgui::GuiSFML gui(window);

I renamed it to:

    tgui::BackendGuiSFML gui(window);


as found in BackendGuiSFML.hpp but it does not help.

||=== Build: Debug in SFML_TGUI (compiler: GNU GCC Compiler) ===|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp||In function 'int main()':|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp|31|error: no matching function for call to 'tgui::BackendGuiSFML::BackendGuiSFML(sf::RenderWindow&)'|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\_LIB\TGUI-0.10\include\TGUI\Backend\Window\SFML\BackendGuiSFML.hpp|48|note: candidate: tgui::BackendGuiSFML::BackendGuiSFML()|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\_LIB\TGUI-0.10\include\TGUI\Backend\Window\SFML\BackendGuiSFML.hpp|48|note:   candidate expects 0 arguments, 1 provided|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
#40
Installation help / Re: Codeblock and TGUI
12 April 2022, 11:45:24
I just have tried https://tgui.eu/examples/0.10/popup-menu/ relaiting pop-up menu to start study of examples of library but trying to build this easy example does not work.

Looking at errors I am quite confused as trying to find "GuiBase" in any hpp file of TGUI is uncessfull.
I rename header to be in line with header file in the TGUI directory:
#include <TGUI/Backend/SFML-Graphics.hpp>
but GuiBase cannot be found anywhere.

C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp|14|error: variable or field 'rightClickCallback' declared void|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp|14|error: 'GuiBase' is not a member of 'tgui'|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp|14|error: 'gui' was not declared in this scope|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp|14|error: expected primary-expression before 'position'|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp||In function 'int main()':|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp|31|error: 'GuiSFML' is not a member of 'tgui'|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp|47|error: 'gui' was not declared in this scope|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp|56|error: 'gui' was not declared in this scope|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp|65|error: 'gui' was not declared in this scope|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp|65|error: 'rightClickCallback' was not declared in this scope|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp|68|error: 'gui' was not declared in this scope|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TEST\SFML_TGUI\main.cpp|72|error: 'gui' was not declared in this scope|
#41
Installation help / Re: Codeblock and TGUI
12 April 2022, 10:36:30
Thanks for the help.

As I am amateur, hobbiest , I have just tried to make it work. I use dynamic linking and it works.
Probably better solution than static linking.
#42
Installation help / Codeblock and TGUI
12 April 2022, 09:30:19
I have tried to install TGUI libraries on Codeblock and so far without success. Firstly I tried development version 1.0, than final stable 0.9, both without success. I am doing probably something wrong. I will try to repeat what I did for version 0.9.

Release 20.03 rev 11983 (2020-03-12 18:24:30) gcc 8.1.0 Windows/unicode - 64 bit
SFML 2.5.1 (it works standalone)

1. downloaded precompiled TGUI 0.9.3 for MinGW 7.3.0 (SEH) - 64-bit
2. setting codeblock as described in tutorial - using static link of libraries (both TGUI and SFML)
3. paths to TGUI is set not relative

Enclosed is error report trying to build simple test program:
Issues is that it seems they are some strange paths

#include <TGUI/TGUI.hpp>


int main()
{
    sf::RenderWindow window{ {800, 600}, "TGUI example - SFML_GRAPHICS backend" };

    tgui::Gui gui{window};
    gui.mainLoop();
}


Any help appretiated.