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.


Messages - texus

Pages: 1 ... 105 106 [107] 108 109 110
1591
Help requests / Re: little explanation on AnimatedPictures
« on: 13 July 2013, 18:07:37 »
You just need the addFrame function.

Code: (cpp) [Select]
animatedPicture->addFrame("Image.png", sf::milliseconds(100));
First parameter is the image filename, second parameter is how long it should be displayed.

1592
Feature requests / Re: Child windows again
« on: 13 July 2013, 17:37:09 »
It has been pushed to github.

1593
Feature requests / Re: Child windows again
« on: 13 July 2013, 15:57:27 »
Good idea.

Looks good (except for the tabs everywhere but that was easily fixed), but I'll still change a few lines.
I'll do that later today.

If I changed the lines, do I need to send you the changes so that you can write a pull request (and have your name next to the commit) or do I just add it to git myself (and add your name in the commit message)?

1594
Feature requests / Re: Child windows again
« on: 13 July 2013, 15:34:11 »
setPosition has to be virtual for other objects.
But when you call Transformable::setPosition explicitly then the virtual won't bother you, only the code in Transformable will be executed.

I should have asked for a different way to patch, because this diff file is a bit hard to read (its even worse because of the changed whitespace, this is because you used tabs instead of spaces).
Could you perhaps run this?
Code: [Select]
git clone https://github.com/texus/TGUI.git
cd TGUI
cp -R changed_tgui_folder .
git diff > changes.diff

That should give a better patch that I can even immediately apply.

1595
Feature requests / Re: Child windows again
« on: 13 July 2013, 14:45:44 »
Or you could send me the changed files and then I'll make the diff myself.

On linux this is super-easy and I only have to type this in the terminal:
diff old_tgui_folder tgui_folder_with_changes > changes.diff

I'm sure there is a similar tool on windows too, but the command prompt isn't really something you open every day.

1596
Feature requests / Re: Child windows again
« on: 13 July 2013, 14:07:36 »
There is a getDisplaySize function in Container, which was added for exactly this reason.

Widget can't access the window, this is why keepInWindow can't be easily done (and I don't really see a use case for it anyway).

1597
Feature requests / Re: Child windows again
« on: 13 July 2013, 13:00:37 »
Is the inWindow really necessary? Isn't an inParent and dontKeep enough?

Quote
If you agree I can submit a simple patch later today. It will be just optional feature and default it will be turned off.
I agree, but I might want to make some small changes on the patch before it gets merged.
If you are going to make a pull request on github then maybe it is better to first post the diff file here so that I can see what you changed exactly and perhaps change a few things. That way I can just merge the pull request immediately.

1598
Quote
And it wont move on the Y Vector. It just load last position and stays there :)
You set the position of the widget and before it is even drawn on the screen you set another position. By the time you draw on the window the button will have already been placed on the last position. It is the same problem that you had with the shaking window. You should do something similar to only change the position of the button once every frame.

AnimatedPicture is not 'animated' as in moving, it is used when the image itself changes. So it is not useful in this situation.

1599
1)
TGUI won't interact with your database, so you'll have to just load the values from the database yourself and then call the corresponding functions to set the value in the tgui widget. But I've never worked with databases before so I can't help much with this.

2)
If you have one config file in the Data folder, then you should give a relative pathname to the images. So button would have the following property:
NormalImage  = "Buttons/Image.png"

Another option would be to have config files for every type of object. So you have a config file in Data/Buttons that only contains the Button section, and you have another config file in Data/Checkboxes that has the Checkbox section and so on. Then you can just have:
NormalImage  = "Image.png"

So the config files can be seperate files or a single file and they contain a relative path to the images. So it shouldn't be to hard to make different folders. The BabyBlue.conf loads different images from different folders, so you might want to take a look at it to see an example.


About the loading from memory...
This isn't supported yet. I'll look into this to see if it can be done easily. If it isn't too much work then I'll add it to v0.6 but if I would have to make a lot of changes then it will be delayed to the next version.

Edit:
Loading from memory is just not possible with the current design. The whole texture managment is build on top of the fact that images are loaded from files. So I would have to find a new design for the texture managment and I would have to change the config files to support this. I'm not even sure if I will be able to add this to the next version.

1600
It wasn't a typo :D.
I changed that function yesterday.

1601
If you no longer need objects then you can use the remove function from Gui to remove them. And then you just create the new objects like you created the old ones.

But it is probably better to use panels. So you create a panel for the login screen and a panel for your other screen. In those panels you add the objects you want (just like you added them to the gui). And then you just hide all panels except the login screen. When the login button is clicked, all that you have to do is hide the panel with your login screen and show the other one.

Edit: Here is a small example of what I am trying to say:
Code: (cpp) [Select]
#include <TGUI/TGUI.hpp>

void loadLoginScreen( tgui::Gui& gui )
{
    tgui::Panel::Ptr loginScreen(gui, "LoginScreen");
    loginScreen->setSize(800, 600);

    // Create the background image
    tgui::Picture::Ptr picture(*loginScreen);
    picture->load("xubuntu_bg_aluminium.jpg");
    picture->setSize(800, 600);

    // Create the username label
    tgui::Label::Ptr labelUsername(*loginScreen);
    labelUsername->setText("Username:");
    labelUsername->setPosition(200, 100);

    // Create the password label
    tgui::Label::Ptr labelPassword(*loginScreen);
    labelPassword->setText("Password:");
    labelPassword->setPosition(200, 250);

    // Create the username edit box
    tgui::EditBox::Ptr editBoxUsername(*loginScreen, "Username");
    editBoxUsername->load("TGUI/widgets/Black.conf");
    editBoxUsername->setSize(400, 40);
    editBoxUsername->setPosition(200, 140);

    // Create the password edit box (we will copy the previously created edit box)
    tgui::EditBox::Ptr editBoxPassword = loginScreen->copy(editBoxUsername, "Password");
    editBoxPassword->setPosition(200, 290);
    editBoxPassword->setPasswordCharacter('*');

    // Create the login button
    tgui::Button::Ptr button(*loginScreen);
    button->load("TGUI/widgets/Black.conf");
    button->setSize(260, 60);
    button->setPosition(270, 440);
    button->setText("Login");
    button->bindCallback(tgui::Button::LeftMouseClicked);
    button->setCallbackId(1);
}

void loadOtherScreen( tgui::Gui& gui )
{
    tgui::Panel::Ptr otherScreen(gui, "OtherScreen");
    otherScreen->setSize(800, 600);

    // Create the background image
    tgui::Picture::Ptr picture(*otherScreen);
    picture->load("xubuntu_bg_aluminium.jpg");
    picture->setSize(800, 600);
}

int main()
{
    // Create the window
    sf::RenderWindow window(sf::VideoMode(800, 600), "TGUI window");
    tgui::Gui gui(window);

    // Load the font (you should check the return value to make sure that it is loaded)
    gui.setGlobalFont("TGUI/fonts/DejaVuSans.ttf");

    // Load the widgets
    loadLoginScreen(gui);
    loadOtherScreen(gui);

    // The login screen is the only panel that should be visible
    gui.get("LoginScreen")->show();
    gui.get("OtherScreen")->hide();

    // Main loop
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

            // Pass the event to all the widgets
            gui.handleEvent(event);
        }

        // The callback loop
        tgui::Callback callback;
        while (gui.pollCallback(callback))
        {
            // Make sure tha callback comes from the button
            if (callback.id == 1)
            {
                // Get the login screen
                tgui::Panel::Ptr loginScreen = gui.get("LoginScreen");

                // Get the username and password
                tgui::EditBox::Ptr editBoxUsername = loginScreen->get("Username");
                tgui::EditBox::Ptr editBoxPassword = loginScreen->get("Password");

                sf::String username = editBoxUsername->getText();
                sf::String password = editBoxPassword->getText();

                // Show the other screen
                loginScreen->hide();
                gui.get("OtherScreen")->show();
            }
        }

        window.clear();

        // Draw all created widgets
        gui.draw();

        window.display();
    }

    return EXIT_SUCCESS;
}

1602
You can just use the Picture class instead of Button.
They both inherit from ClickableObject which makes them have the LeftMousePressed, LeftMouseReleased and LeftMouseClicked callbacks.

The numbers behind the "Black.png" is the rectangle to load from the file. If you load the whole image then they can be ommited.
The left part of the normal image of the button starts at (0, 25) in the image and has a width of 50 and a height of 50, hence "(0, 25, 50, 50)".

You shouldn't edit Black.conf. You should make a copy of it and in your code load that copy which you can freely edit.

Edit: There is a small tutorial about the config files.

Edit2: I forgot to answer the question about tooltips. This is not yet possible. I did a poll once about what widget I should add. The first two were MessageBox and MenuBar (which now exist in tgui). ToolTip and PopupMenu came 3th and 4th, but they won't be in v0.6.0. They will probably be the next widgets that will be added but they will have to wait for v0.6.1 or v0.7.

1603
Help requests / Re: Shaking window
« on: 09 July 2013, 19:20:40 »
I just answered on the sfml forum :).

1604
Installation help / Re: gcc errors in linux
« on: 09 July 2013, 10:51:55 »
Ok, thanks for testing.

I'll fix those warnings later today.
EDIT: Done

1605
Installation help / Re: gcc errors in linux
« on: 09 July 2013, 00:29:40 »
Any chance you have nvidea graphics?

If I look for the error then I find this page and this page.
Both aren't exactly the same error (different paths), but they both say that a symbolic link has to be made.

Pages: 1 ... 105 106 [107] 108 109 110