I wouldn't know any good way either, I guess you'll just have to keep differentiating the classes with 'Button' and 'tgui::Button'.
But what you are doing looks really interesting.
But what you are doing looks really interesting.
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 MenuQuoteAs for the Observer Pattern, that's essentially what I'm doing right?Yes, but it was hard to tell with seeing little code.
QuoteAlso, any recommendations for how to name my stuff? Because I plan to do this with all the types: Buttons, Sliders, ect. And I thought I should put some sort of differentiation between my Buttons and the tgui buttons. The namespace solves it, but still.I don't really see why you would need all these classes.
class MyWidget : public IOBase
{
MyWidget(tgui::Widget::Ptr widget) :
m_widget(widget)
{
}
tgui::Widget::Ptr m_widget;
}
MyWidget myWidget{ tgui::Button::Ptr(gui) };
QuoteWhy does label cut letters underline like in the picture in attachment?I've fixed this bug a couple of times, but it seems like it always comes back. Are you using TGUI v0.6.1 or the version from github? I actually can't reproduce it with either version.
QuoteAnd how to place a picture as a button?Just use tgui::Picture::Ptr. You can also bind a click callback to it.
QuoteIs it possible, and if it is, how to, place an url as a label?Do you just mean a clickable text? You can just let it send a callback when you click on the label and then handle the click yourself.
QuoteIs this the BEST way for my button to accomplish that? I know I can do it using callBackId() but I think that's worse.First of all, there is no best way. But binding callback is indeed much better than polling from the gui.
Quoteclass myButton : public IOBase, public tgui::Button //<---should that be tgui::Button::Ptr?I don't even think that inheriting from tgui::Button::Ptr is an option. Although it might compile, it probably won't do what you expect.
typedef SharedWidgetPtr<myButton> Ptr;myButton::Ptr button(gui);QuoteI would also like to say that this https://github.com/texus/TGUI/blob/master/examples/FullExample/FullExample.cpp, or something like it should be linked in the tutorials. Examples are the most useful thing in the world, and the tutorial only goes over a few things.I'll add a link at the bottom of the tutorial to both the documentation and the example code.
#include <TGUI/TGUI.hpp>
void sliderValueChanged(const tgui::Callback& callback)
{
std::cout << "Value is: " << callback.value << std::endl;
}
int main()
{
sf::RenderWindow window{sf::VideoMode{800, 600}, "TGUI window"};
tgui::Gui gui(window);
gui.setGlobalFont("TGUI/fonts/DejaVuSans.ttf");
tgui::Slider::Ptr slider(gui);
slider->load("TGUI/widgets/Black.conf");
slider->setVerticalScroll(false);
slider->setPosition(50, 50);
slider->setSize(250, 25);
std::cout << "Value is: " << slider->getValue() << std::endl;
// Call the sliderValueChanged function when the value of the slider is changed
slider->bindCallbackEx(sliderValueChanged, tgui::Slider::ValueChanged);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
gui.handleEvent(event);
}
window.clear();
gui.draw();
window.display();
}
return 0;
}
Quoteside question: which one should i use as slider for music volume? slider2d or slider?The normal slider. The 2d version is more for something like a color palette.
QuoteI have coped the libstdc++6 lib to the project folder from the mingw bin and this error appears.I'm not sure what you are trying to accomplish with this.
Quotesfml 2.1 is working fine by its ownThe precompiled TGUI download also contains SFML libraries. When using TGUI, make sure you use these libraries.
QuoteCMake Error at cmake/Config.cmake:13 (message):This config file is directly copied from sfml, so I doubt it is going to contain any mistakes.
Unsupported architecture
QuoteThe tutorial from the site says the path is:Which page on my site says that?
TGUI/widgets/Button/Black
QuoteIn my console prompt it reads:It took my a moment to realize what is wrong with this. You need to load a config file, not an image. The config file will tell tgui which images to load and which parts of the images should be shown. So you have to load "TGUI/widgets/Black.conf" instead.
TGUI error: Failed to parse TGUI/widgets/Black.png
QuoteI am using Visual Studio 2012
QuoteThe program can't start because MSVCP120D.dll is missingThis looks strange to me, because MSVCP120D.dll is from Visual Studio 2013.
Quoteit doesn't effect the programThen we are talking about a different issue.
editBox->bindCallback(std::bind(&MyClass::function, &myObj), tgui::EditBox::ReturnKeyPressed);editBox->bindCallback(&MyClass::function, &myObj, tgui::EditBox::ReturnKeyPressed);widget.fenĂȘtre->bindCallbackEx(&cVanne::fermerWidget, this, tgui::ChildWindow::Closed);
.QuoteFeature request: It would be nice if we could set the spacing between each line manually too.I've been thinking about it and I don't think I will do this, it would hardly ever get used and I would have to add several functions to support setting a different line spacing for every line and for reusing the default spacing. Setting one line spacing for the whole chatbox is something that I would do, but it doesn't fit with the fact that you can set a different font and text size for every line.
Quote~15% of the fonts i tested (around 20) didn't work, would be interessting to know whyThe problem of these fonts are that their line spacing is too small. The sf::Font::getLineSpacing function returns a value smaller than the character size. Due to badly placed brackets and the use of unsigned ints, subtracting the character size from the line spacing ended up being a really huge number
.