Precentage in setSize or setPosition does nothing
sandorex opened this issue · comments
Sandorex commented
I downloaded TGUI 2.7.6 for SFML 2.4.2 and 100% in setSize, setPosition doesn't work, the element dissapears
im compiling on windows 10 using msbuild project made by cmake
my code:
#include <cstdio>
#include <iostream>
#include <TGUI/TGUI.hpp>
#include "about.h"
int main(int argc, char *argv[])
{
sf::RenderWindow window(sf::VideoMode(800, 600), "APP " VERSION_STRING);
tgui::Gui gui(window);
sf::Image img;
img.loadFromFile("icon.png");
window.setIcon(img.getSize().x, img.getSize().y, img.getPixelsPtr());
auto button = tgui::Button::create("Click me!");
button->setPosition({"50.0", "25.0"});
gui.add(button);
auto picture = tgui::Picture::create("icon.png");
picture->setSize({"100%", "100%"});
gui.add(picture);
window.setFramerateLimit(80);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
else if (event.type == sf::Event::Resized)
{
window.setView(sf::View(sf::FloatRect(0, 0, (float)event.size.width, (float)event.size.height)));
gui.setView(window.getView());
}
gui.handleEvent(event);
}
window.clear();
gui.draw();
window.display();
}
return 0;
}
Bruno Van de Velde commented
What TGUI version are you using, 0.7 or 0.8?
This may happen is you are using 0.7, as using "100%" is something that only works in 0.8.
Sandorex commented
It is 0.7 i just hit wrong number, thanks anyways