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

Topics - Heinrich

#1
General Discussion / libconfig & JSON
26 November 2014, 22:24:22
Hello Bruno,

Have you given thought to using XML format?
I am extensively using custom XML config files myself and read and write them with tinyxml https://www.grinninglizard.com/tinyxml2/. It's fast and header-only.
However, tinyxml does not understand DTDs for validation. If you go for XML, check this helpful image:
https://i.stack.imgur.com/hUjpw.png

[spoiler]I still owe you that 0.7 tutorial, I'm a huge slacker
#2
General Discussion / changing theme files
16 October 2014, 14:06:47
I read this on your blog
QuoteThinking about a new design...

// Load one theme that is shared between widgets
tgui::Theme theme{"Black.conf"};

// Create widgets based on that theme
auto button = tgui::Button::create(theme);

// Change the theme for all connected widgets on the fly
theme->changeProperty("Button", "TextColorNormal", "(200, 200, 200)");

Wow, this sounds good. What would happen if I create an element with a theme object and later I want to change a property on this element only? Reminds me a little of the setGlobalTextSize() issues.

A short user story how I use tgui:
I have several game states (startup, main menu, game lobby, game room, ..). No two states can be active at the same time. I share a global tgui::gui between all states. When a new state is transitioned into, all widgets get removed from the global tgui::gui and the specific state widgets get reloaded.
Each state has it's own gui elements and it's own theme.conf. On state creation I load everything with element::create("myState.conf") and hide() and show() and connect() accordingly. Then on some elements, I change properties via getRenderer() because I didn't want an extra theme.conf for a single Button. Sometimes gui elements need to be created dynamically. That is, when game objects offer to be configured. These objects have a tgui::Widget::Ptr getConfigWidget() interface and the state loops over the objects to get the widgets and add them to the tgui::gui.

#3
Help requests / List of all signals
15 October 2014, 15:29:28
Where can I find one? I'm especially looking for something like "selected" in listbox.

Edit: I found where they are defined. Maybe you want to compile a list for your tutorial.
#4
Feature requests / SetGlobalFontSize()
15 October 2014, 13:11:34
Oftentimes my code looks like


widget = create();
widget->setTextSize(Globals::getGuiTextSize());


Having it as a parameter in .conf files would also be an option. Well, this is for people who want the same font size in all their widgets anyway.

Also: Currently it is imho impossible to change the text size of entries in tgui::combobox. Even when I get the renderer for the widget. Also the sf::text is never exposed, so getting the text somehow and setting it there doesn't work either.

What do you think?
#5
Feature requests / setTexture in Buttons
13 October 2014, 04:48:22
I'd like it. What do you think? Probably in every Widget. For changing the Button texture dynamically.
#6
It think it would really come in handy to have a method that specifies how child widgets should be positioned (e.g. center horizontally, center vertically, default=none). In my use case, I have a Panel and a Grid inside this Panel, now I want to have the Grid centered inside the panel.
Also: Grid has a method for changing the alignment of a widget inside one cell, for convenience, a method to change every cell would be nice.  However, I may be overseeing some possibilities tgui provides.
#7
Are there pitfalls on having multiple GUI objects? Or is it recommended to have one and only one GUI object (and access it via Singleton or something).
#8
Installation help / 0.7dev Compilation error
06 October 2014, 16:30:32
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
2>------ Build started: Project: tgui, Configuration: Debug Win32 ------
2>  Button.cpp
2>  Canvas.cpp
2>  ChatBox.cpp
2>ChatBox.cpp(586): warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
2>  Checkbox.cpp
2>  ComboBox.cpp
2>  Container.cpp
2>C:\Users\User\Documents\RKN\ext\tgui\TGUI-0.7-dev\include\TGUI/TextBox.hpp(412): error C2664: 'std::vector<sf::String,std::allocator<_Ty>>::vector(std::initializer_list<sf::String>,const std::allocator<_Ty> &)' : cannot convert argument 1 from 'const char [1]' to 'const std::allocator<_Ty> &'
2>          with
2>          [
2>              _Ty=sf::String
2>          ]
2>          Reason: cannot convert from 'const char [1]' to 'const std::allocator<_Ty>'
2>          with
2>          [
2>              _Ty=sf::String
2>          ]
2>          No constructor could take the source type, or constructor overload resolution was ambiguous
2>C:\Users\User\Documents\RKN\ext\tgui\TGUI-0.7-dev\include\TGUI/Gui.hpp(469): error C2783: 'std::shared_ptr<_Ty> std::make_shared(_Types &&...)' : could not deduce template argument for '_Ty'
2>          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\memory(1000) : see declaration of 'std::make_shared'
2>  EditBox.cpp
2>  Gui.cpp
2>C:\Users\User\Documents\RKN\ext\tgui\TGUI-0.7-dev\include\TGUI/Gui.hpp(469): error C2783: 'std::shared_ptr<_Ty> std::make_shared(_Types &&...)' : could not deduce template argument for '_Ty'
2>          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\memory(1000) : see declaration of 'std::make_shared'
2>          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\memory(1000) : see declaration of 'std::make_shared'
2>          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\memory(1000) : see declaration of 'std::make_shared'
2>          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\memory(1000) : see declaration of 'std::make_shared'
2>  Knob.cpp
2>  Layout.cpp
2>C:\Users\User\Documents\RKN\ext\tgui\TGUI-0.7-dev\include\TGUI/Gui.hpp(469): error C2783: 'std::shared_ptr<_Ty> std::make_shared(_Types &&...)' : could not deduce template argument for '_Ty'
2>          C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\memory(1000) : see declaration of 'std::make_shared'
2>  Picture.cpp
2>  ProgressBar.cpp
2>  RadioButton.cpp
2>  Scrollbar.cpp
2>Scrollbar.cpp(673): warning C4244: 'argument' : conversion from 'int' to 'float', possible loss of data
2>Scrollbar.cpp(675): warning C4244: 'argument' : conversion from 'int' to 'float', possible loss of data
2>Scrollbar.cpp(677): warning C4244: 'argument' : conversion from 'int' to 'float', possible loss of data
2>Scrollbar.cpp(679): warning C4244: 'argument' : conversion from 'int' to 'float', possible loss of data
2>  Signal.cpp
2>  Slider.cpp
2>Slider.cpp(204): warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
2>Slider.cpp(209): warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
2>  TextBox.cpp
2>C:\Users\User\Documents\RKN\ext\tgui\TGUI-0.7-dev\include\TGUI/TextBox.hpp(412): error C2664: 'std::vector<sf::String,std::allocator<_Ty>>::vector(std::initializer_list<sf::String>,const std::allocator<_Ty> &)' : cannot convert argument 1 from 'const char [1]' to 'const std::allocator<_Ty> &'
2>          with
2>          [
2>              _Ty=sf::String
2>          ]
2>          Reason: cannot convert from 'const char [1]' to 'const std::allocator<_Ty>'
2>          with
2>          [
2>              _Ty=sf::String
2>          ]
2>          No constructor could take the source type, or constructor overload resolution was ambiguous
2>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\algorithm(4141): warning C4244: 'argument' : conversion from 'float' to 'const unsigned int', possible loss of data
2>TextBox.cpp(342): warning C4244: 'argument' : conversion from 'float' to 'const unsigned int', possible loss of data
2>TextBox.cpp(420): warning C4244: '=' : conversion from 'float' to 'unsigned int', possible loss of data
2>  TextureManager.cpp
2>  ThemeFileParser.cpp
2>  Tooltip.cpp
2>  Generating Code...
2>c:\users\user\documents\rkn\ext\tgui\tgui-0.7-dev\src\tgui\combobox.cpp(209): fatal error C1001: An internal error has occurred in the compiler.
2>  (compiler file 'f:\dd\vctools\compiler\utc\src\p2\ehexcept.c', line 956)
2>   To work around this problem, try simplifying or changing the program near the locations listed above.
2>  Please choose the Technical Support command on the Visual C++
2>   Help menu, or open the Technical Support help file for more information
3>------ Build started: Project: ALL_BUILD, Configuration: Debug Win32 ------
3>  Build all projects
4>------ Skipped Build: Project: INSTALL, Configuration: Debug Win32 ------
4>Project not selected to build for this solution configuration
========== Build: 2 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========


Unfortunately I am not a template guy, can you figure out what's wrong?
#9
General Discussion / TGUI rocks
02 October 2014, 13:50:33
  :) :D ;D
Just came by to tell you that I really appreciate your work and cannot wait for 0.7 release. I read on your blog 0.7 has 9-slice-scaling. I'm really looking forward to this.
How will it work? I've had a quick look at the 0.7 Black.conf, don't I need to set the slices manually? Or are you doing some leftSlice.size.x = image.size.x/3? Never mind, I found Texture.cpp. 8)
#10
Help requests / Switching to 0.7
23 September 2014, 13:38:03
Hello,

I am (still) using v0.6 for a hobby project.  Would you recommend switching to 0.7 now or should I await later versions?
#11
Help requests / LoadFromFile() & callbacks
31 August 2013, 15:43:46
I couldn't find out how to specify callbacks when loading from a file. Or how to otherwise get informed of events. Please assist.
#12
Feature requests / focusPrevious()
29 August 2013, 13:07:31
Hello again,

How about you add focusPrevious() to widget class. So you can easily make your gui keyboard navigable. Of course you could do this by retaining some pointers to the widgets and handle it all manually, but in the simplest case, you would add some buttons and call focusNext() and focusPrevious() when Left or Right key is pressed.
I suppose I could do this as well by adding the widgets into a grid and use get(), but it would be a nice convenience function.
Also, I added some small issue on your bug tracker, which is well hidden.

glhf
Heinrich
#13
First of all: Gute Arbeit! Good Work!

My proposal:
To have a size independant gui without scaling artifacts  you need to be able to split in vertical direction also.

Instead of
xxx_L, xxx_M and xxx_R
you would need to define upper left corner, lower left corner, upper middle part, lower middle part, left middle part, right middle part, upper right corner and lower left corner.

Sounds like a bunch.
But wait, assuming your button symmetrical, you might get away with one corner, one middle part, and the middle. You'd just need to mirror each part accordingly. Which btw you could also do in the old splitimage with the left and right parts.

What do you think?