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

Pages: [1]
1
Graphics / Re: problems rendering text (SFML 2.0)
« on: August 26, 2012, 08:43:48 am »
This worked, thanks so much!

sf::Font font;
font.loadFromFile("Resources\\segoe.ttf");
       
sf::Text text;
text.setString("Hello");
text.setFont(font);
 

I had actually tried loading in a font before, but forgot to escape the slash in my path, and so I thought text rendering just wasn't working for me.

2
Graphics / Re: SFML 2.0 Graphics linking error
« on: August 26, 2012, 07:57:03 am »
Have not encountered this, but it looks like the version of SFML you're linking to has the std libs built-in, and your project is also set to link them in directly, which will result in duplicate definitions in the binary.

If you built the SFML libs from CMAKE, try unchecking the SFML_USE_STATIC_STD_LIBS option and building the library again. This will give you a set of sfml static libs that don't have the std libs included.

If you just downloaded SFML binaries from somewhere, try going to Linker -> Input -> Ignore Specific Default Libraries in your project settings and adding libcmtd;libcpmtd;msvcrtd to the list for debug and libcmt;libcpmt;msvcrt for release. This will tell the linker to not try linking in the stdlibs directly, as you're already linking to sfml libs that already have them.

More info here: http://msdn.microsoft.com/en-us/library/abx4dbyh(v=vs.110).aspx


3
Graphics / problems rendering text (SFML 2.0)
« on: August 26, 2012, 07:35:25 am »
So I built SFML 2.0 straight from the GitHub repo, and I'm trying to run this

sf::RenderWindow window(sf::VideoMode(300,200), "SFML Test");
sf::Text text;
text.setString("Hello");

while (window.isOpen())
{
        sf::Event event;
        while(window.pollEvent(event))
        {
                if (event.type == sf::Event::Closed)
                        window.close();
        }
        window.clear();
        window.draw(text);
        window.display();
}

First of all, I think the sample code in the tutorial (under 2.0 node) as well as the example in the documentation for sf::Text needs to be updated as there is no constructor for sf::Text that takes in a string directly. I tried sf::Text text("Hello"); and got a compiler error :(

Anyway, running the above code I just get a window with no text displayed. Is there something I'm missing? Do I need to specify extra parameter to the Text object (font, color, etc?) before it will show up in the window? I got the impression from the docs that it comes with a default font, so I didn't think I needed to.

Pages: [1]
anything