Removing TGUI_API worked. Thank you
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#pragma once
struct Test
{
void test();
};
#include "Test.h"
#include <SFML/Graphics.hpp>
void Test::test()
{
sf::FloatRect r;
}
#include <SFML/Graphics.hpp>
#include <TGUI/TGUI.hpp>
int main()
{
sf::FloatRect r;
return 0;
}
sf::RenderWindow window{ { 800, 600 }, "Window" };
tgui::Gui gui{ window }; // Create the gui and attach it to the window
auto scrollPanel = tgui::ScrollablePanel::create({ "50%", "50%" });
auto grid = tgui::Grid::create();
for (int i = 0; i < 100; ++i)
{
auto label = tgui::Label::create("Hi");
label->getRenderer()->setBackgroundColor(sf::Color::Green);
label->setSize({ tgui::bindWidth(scrollPanel), tgui::bindHeight(scrollPanel) / 10});
grid->addWidget(label, i, 0);
}
scrollPanel->add(grid);
gui.add(scrollPanel);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
gui.handleEvent(event); // Pass the event to the widgets
}
window.clear();
gui.draw(); // Draw all widgets
window.display();
}
auto scrollPanel = tgui::ScrollablePanel::create({ "75%", "75%" });
scrollPanel->getRenderer()->setBackgroundColor(sf::Color::Green);
auto grid = tgui::Grid::create();
for (int i = 0; i < 100; ++i)
{
auto h = tgui::HorizontalLayout::create({ tgui::bindWidth(scrollPanel), tgui::bindHeight(scrollPanel) / 10 });
h->add(tgui::Label::create("Hello"));
h->add(tgui::Label::create("Hello"));
h->add(tgui::Label::create("Hello"));
h->add(tgui::Label::create("Hello"));
grid->addWidget(h, i, 0);
}
gui.add(scrollPanel);
scrollPanel->add(grid);
auto scrollPanel = tgui::ScrollablePanel::create({ "300", "300" });
scrollPanel->getRenderer()->setBackgroundColor(sf::Color::White);
auto grid = tgui::Grid::create();
grid->setAutoSize(true);
for (int r = 0; r < 100; ++r)
grid->addWidget(tgui::Label::create("h"), r, 0);
scrollPanel->add(grid);
gui.add(scrollPanel);