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 - AlexxanderX

#1
Feature requests / Table
11 December 2015, 15:23:23
For my game I need a table and Grid doesn't satisfy me. I started working on creating a table, but I want to know if the idea is good: a Row class that's a HorizontalLayout with functions like addItem(string column) who to add Label to the layout. Then, in the class Tabel a function to add the rows to the container. Tabel class to be a BoxLayout and to arrange the items vertically, but one after one.
#2
I have this code line:m_menuBar->connect("MouseEntered", [&](){ std::cout << "ENTERED\n"; }); and it's working only one time and then nothing.

Could you add signal MousePressed to MenuBar?
#3
Quoteobj/Handler.o: In function `ZN4tgui12extractTypesIIN2sf7Vector2IfEEEE6getRowEv':

D:/Programare/Libs/TGUI/include/TGUI/Signal.hpp:71: undefined reference to `std::string tgui::convertTypeToString<sf::Vector2<float> >()'
collect2.exe: error: ld returned 1 exit status

From what I read on the 0.7-dev documentation the signal "MousePressed" can have an optional parameter sf::Vector2f position, but I don't know how to use it because I'm receiving the above error from using this code:
m_windowTiles->connect("MousePressed", [this](sf::Vector2f position){ m_map->removeLastTile(); });
#4
Feature requests / Resize button by text size
21 January 2015, 15:58:35
auto buttonCreate = tgui::Button::create(THEME_CONFIG_FILE);
buttonCreate->setText("Create");
buttonCreate->setTextSize(20);


Without setting the size of the button, but by setting the text size the button should calculate the correct size of the button. In the version 0.6 this was working but now doesn't work anymore.
#5
Quoteerror: static assertion failed: Parameters passed to the connect function are wrong!
static_assert(!std::is_same<Func, Func>::value, "Parameters passed to the connect function are wrong!");

I have using this code:
buttonCreate->connect("Pressed", std::bind(&Handler::createNewMap, this), editBoxWidth, editBoxHeight);

void Handler::createNewMap(tgui::EditBox::Ptr editBoxWidth, tgui::EditBox::Ptr editBoxHeight)
{ ... }
#6
Help requests / Callback help!
04 July 2013, 14:47:02
Hello! I have writed next code:
Handler::Handler()
{
window.create(sf::VideoMode(800,600),"SpeedCuber Challenge");
window.setFramerateLimit(60);

Menu menu(window);

while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
                window.close();
}
menu.callback();
window.clear(sf::Color(203,201,207));
menu.draw();
window.display();
}
}

Menu::Menu(sf::RenderWindow& window): guiWindow(window)
{
stage = 0;

guiWindow.globalFont.loadFromFile("res/Font/DejaVuSans.ttf");
changeMenu();
}

void Menu::draw()
{
guiWindow.draw();
}

void Menu::callback()
{
tgui::Callback callback;
    while (guiWindow.getCallback(callback))
    {
#ifdef DEBUG
    std::cout << callback.callbackID << "\n";
#endif
    switch (callback.callbackID)
        {
            case 2:
            {
            // Make sure the button was pressed
            if (callback.trigger == tgui::Callback::mouseClick)
            {
            ++stage;
            changeMenu();
            exit(1);
            }
            break;
            }
        }
    }
}

void Menu::changeMenu()
{
switch (stage)
{
case 0:
{
guiWindow.removeAllObjects();

tgui::Button* BTNserver = guiWindow.add<tgui::Button>();
BTNserver->load("res/Button/Black");
BTNserver->setSize(200,100);
BTNserver->setPosition(400-BTNserver->getSize().x/2,100);
BTNserver->setText("Server");
BTNserver->callbackID = 1;

tgui::Button* BTNclient = guiWindow.add<tgui::Button>();
BTNclient->load("res/Button/Black");
BTNclient->setSize(200,100);
BTNclient->setPosition(400-BTNclient->getSize().x/2,200);
BTNclient->setText("Client");
BTNclient->callbackID = 2;
break;
}
case 2:
{
guiWindow.removeAllObjects();

tgui::Label* LBLaddress = guiWindow.add<tgui::Label>();
LBLaddress->setText("Address:");
LBLaddress->setPosition(1,1);

tgui::EditBox* EDBaddress = guiWindow.add<tgui::EditBox>();
EDBaddress->load("res/EditBox/Black");
EDBaddress->setPosition(20,20);
EDBaddress->setSize(100,40);
break;
}
}
}


And can't figure out how to make the BTNclient(ID=2) to work... When I click on him doesn't happen nothing. When I click need to increment the stage and redraw another objects( changeMenu()).
The code is the sample from my 2 classes( Handler, Menu).

----
I'm on Linux and tried to install it bun when I finished and tryed the example I got error: "TGUI/TGUI.hpp can't find". So the headers(include folder) can't be finded so I verified in /usr/local/include and there was no TGUI folder with headers so I copied the folder from include and putted in /usr/local/include to can figure out the problem.