Welcome, Guest. Please login or register. Did you miss your activation email?

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

Pages: 1 [2] 3
16
General / Re: [SOLVED][TGUI] Label Widget isn't displaying on Compile?
« on: April 13, 2014, 07:16:40 am »
Fixed because font loading line was not found :)

17
General / [SOLVED][TGUI] Label Widget isn't displaying on Compile?
« on: April 13, 2014, 04:34:25 am »
Hi there, I have successfully installed TGUI (An SFML GUI Library), and I have gotten the library working correctly to the point where it shows the text boxes and buttons, but It does not show my Labels for Username and Password.

This is what it looks like:


and this is the code I am using to create the GUI:
#include <TGUI/TGUI.hpp>

void loadWidgets(tgui::Gui& gui)
{
        // Create the background image
        tgui::Picture::Ptr picture(gui);

        // Create the username label
        tgui::Label::Ptr labelUsername(gui);
        labelUsername->load("data/TGUI/widgets/White.conf");
        labelUsername->setText("Username:");
        labelUsername->setPosition(70,60);

        // Create the password label
        tgui::Label::Ptr labelPassword(gui);
        labelPassword->setText("Password:");
        labelPassword->setPosition(70,100);

        // Create the username edit box
        tgui::EditBox::Ptr editBoxUsername(gui, "Username");
        editBoxUsername->load("data/TGUI/widgets/White.conf");
        editBoxUsername->setSize(170,27);
        editBoxUsername->setPosition(140,58);

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

        // Create the login button
        tgui::Button::Ptr button(gui);
        button->load("data/TGUI/widgets/White.conf");
        button->setSize(80, 22);
        button->setPosition(140,140);
        button->setText("Login");
        button->bindCallback(tgui::Button::LeftMouseClicked);
        button->setCallbackId(1);

        // Create the register button
        tgui::Button::Ptr regbutton = gui.copy(button, "Register");
        regbutton->setPosition(230, 140);
        regbutton->bindCallback(tgui::Button::LeftMouseClicked);
        regbutton->setCallbackId(1);
}

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

        // Load the widgets
        loadWidgets(gui);

        // 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 username and password
                                tgui::EditBox::Ptr editBoxUsername = gui.get("Username");
                                tgui::EditBox::Ptr editBoxPassword = gui.get("Password");

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

                                // Continue here by checking if the username and password are correct ...
                        }
                }

                window.clear(sf::Color::White);

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

                window.display();
        }

        return EXIT_SUCCESS;
}
 

If somebody would be able to find out what I've missed out on, that would be great.

Cheers

18
Network / Re: Opening Website File to show in Window
« on: April 11, 2014, 03:18:18 pm »
There are extension libraries like SFGUI or TGUI (search in the project forum) for the purpose of user interfaces, but websites are a whole different topic.

Alrighty, Ill have a look, cheers.

19
Network / Re: Opening Website File to show in Window
« on: April 11, 2014, 11:55:49 am »
You mean if it's possible to implement a simple web browser with SFML?

SFML supports the HTTP protocol, which you can use to fetch website contents, but you have to parse the HTML and CSS code yourself and display everything correctly. It will be a giant effort with very limited results (websites can become arbitrarily complex, if you consider scripts, forms, ...), so you'd better use something other than SFML.

Aww, ok :). I just thought of that when I was thinking about user input into text boxes, since SFML doesn't support GUI objects from what I've read.

20
Network / [Solved] Opening Website File to show in Window
« on: April 11, 2014, 11:49:16 am »
Hi, would it be possible to open a website page or a file and show the contents of the site in the window? I have had a look at searching and found nothing on this topic, so I'm unsure if anybody has tried this yet.

If there is a way, what would be the best solution to achieve it?

Cheers

21
General / Re: How to find the Static DLL's?
« on: April 09, 2014, 04:44:24 pm »
Using VS 2012 libraries with VS 2013 will not work.

Well that stink's, my CMAKE I got earlier today doesnt even do VS 2013 :((
Remember that VS 2013 is == VS v. 12 ;)
Blame MS for confusing versioning...
Sweet, I built a up to date one then earlier :) Woo, lets test.

22
General / Re: How to find the Static DLL's?
« on: April 09, 2014, 04:40:16 pm »
Using VS 2012 libraries with VS 2013 will not work.

Well that stink's, my CMAKE I got earlier today doesnt even do VS 2013 :((

23
General / Re: How to find the Static DLL's?
« on: April 09, 2014, 04:21:59 pm »
Ok, now it's spat out an error at me

Error   1       error LNK2001: unresolved external symbol "public: static class sf::Color const sf::Color::White" (?White@Color@sf@@2V12@B)
 

Thats using SFML_STATIC
and linking sfml-graphics-s-d.lib when building etc.

It also spits out this

Error   11      error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in game.obj

24
General / Re: How to find the Static DLL's?
« on: April 09, 2014, 02:24:37 pm »
So if you don't get an error, how do you know something went wrong? ;D

I havent any clue  :-\ anyway, can you answer my question just before? Is it possible to load the dlls in subfolder when building/running?

e.g "data/libs/<sfml-dll here>"

25
General / Re: How to find the Static DLL's?
« on: April 09, 2014, 01:42:01 pm »
So you really don't want to show us your error message(s)?

I never got any, thats the point.

26
General / Re: How to find the Static DLL's?
« on: April 09, 2014, 01:26:03 pm »
Quote
I just cant get my project to build when using SFML_STATIC
It would be much more efficient to show us what compiler/linker errors you get, instead of trying to deduce a wrong solution by yourself and wasting everybody's time in the wrong direction ;)

Decided against using static, I thought of just moving the dll's into a subfolder so its not being seen straight away. Is there a way I have Visual Studio 2013 compile with the dlls in a subfolder? e.g. "data/libs/sfml-graphics-2.dll"

27
General / Re: How to find the Static DLL's?
« on: April 09, 2014, 12:15:54 pm »
Because it is static, a static library has no DLL. Instead of being in a separate DLL in case of dynamic linking, the SFML code will be integrated directly into your executable if you link the static libraries.

If you were searching the DLLs, what did you think the static version of SFML was, compared to the dynamic one? ;)

I thought there would be a sfml-graphics-s-d.dll file that could be included, I just cant get my project to build when using SFML_STATIC, frustrating to do so.

28
General / Re: How to find the Static DLL's?
« on: April 09, 2014, 12:07:09 pm »
Static DLLs? DLL stands for Dynamic Link Library ???

Do you mean import libraries? Have you looked at the download page?

I mean, to compile in SFML_STATIC I need Static Library's, but I can't find the sfml-graphics-s-d.dll file anywhere for any module.

29
General / How to find the Static DLL's?
« on: April 09, 2014, 11:35:04 am »
Hi all,

Does anybody know where I can find the Static DLLS for SFML 2.1? I have done searching on the forums and cant really find anything about where they are found.

Can anybody tell me where/how to get them?

Cheers

30
Got it working, but when drawing it is still slow, am I missing something?

        t_grass.loadFromFile("images/grass.png");

        for (int x = 0; x < 150; x++){
                for (int y = 0; y < 150; y++){
                        sf::VertexArray lines(sf::Quads, 4);
                        lines[0].position = sf::Vector2f(x * 16, y * 16);
                        lines[1].position = sf::Vector2f((x + 1) * 16, y * 16);
                        lines[2].position = sf::Vector2f((x + 1) * 16, (y + 1) * 16);
                        lines[3].position = sf::Vector2f(x * 16, (y + 1) * 16);

                        lines[0].texCoords = sf::Vector2f(0 * 16, 0 * 16);
                        lines[1].texCoords = sf::Vector2f((0 + 1) * 16, 0 * 16);
                        lines[2].texCoords = sf::Vector2f((0 + 1) * 16, (0 + 1) * 16);
                        lines[3].texCoords = sf::Vector2f(0 * 16, (0 + 1) * 16);
                        window.draw(lines, &t_grass);
                }
        }
 

Pages: 1 [2] 3
anything