I've been playing around with layouts and I've found a possible bug. First, I compiled this code (and it worked as expected, drawing both the panel and the text box on the window in the right positions):
outcome shown in "right.png"
The problem is that when I change the eighth line of the first segment of code from this:
to this:
which is what I want to do, but really I could change i 8)t to whatever inolves any type of calculation, like:
and still the problem will persist. The problem is that the text box becomes invisible (outcome shown in "wrong.png").
The only way I can seem to solve the issue is by drawing the textbox directly to the window, but this seems just some kind of workaround... so is this a bug or am I doing something wrong?
Also, as a side note, I've tryed receiving input from the panel via panel->handleInput(const sf::Event& event) but the compiler tells me that the function is protected. Is there any other way of doing this without relying on guis (aka, in my case, using panels)?
Code (cpp) Select
/*! constructor inside a class that handles a text based interface */
mDialogInterface = std::make_shared<tgui::Panel>();
mDialogInterface->setPosition(0, mWindow->getSize().y / 4.f * 3.f);
mDialogInterface->setSize(mWindow->getSize().x, mWindow->getSize().y / 4.f);
mDialogInterface->setBackgroundColor(sf::Color::Red);
auto dialogBox = std::make_shared<tgui::TextBox>();
dialogBox->setText("hello there!");
dialogBox->setSize("parent.width / 4 * 3", "parent.height");
dialogBox->setPosition("parent.left", "parent.top");
mDialogInterface->add(dialogBox, "dialog");
Code (cpp) Select
/*! function that handles drawing (from the same class) */
void *::handleDrawing()
{
... //draw other stuff using views
mWindow->setView(mWindow->getDefaultView());
mWindow->draw(*mDialogInterface);
}
outcome shown in "right.png"
The problem is that when I change the eighth line of the first segment of code from this:
Code (cpp) Select
dialogBox->setPosition("parent.left", "parent.top");to this:
Code (cpp) Select
dialogBox->setPosition("parent.width / 4", "parent.top");which is what I want to do, but really I could change i 8)t to whatever inolves any type of calculation, like:
Code (cpp) Select
dialogBox->setPosition("parent.left + 1", "parent.top");and still the problem will persist. The problem is that the text box becomes invisible (outcome shown in "wrong.png").
The only way I can seem to solve the issue is by drawing the textbox directly to the window, but this seems just some kind of workaround... so is this a bug or am I doing something wrong?
Also, as a side note, I've tryed receiving input from the panel via panel->handleInput(const sf::Event& event) but the compiler tells me that the function is protected. Is there any other way of doing this without relying on guis (aka, in my case, using panels)?
