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

Pages: [1]
1
Graphics / Re: Text on the screen?
« on: July 11, 2013, 01:26:09 pm »
After making those 3 changes, the text should be drawn.
It can only be a driver issue if the examples from sfml don't even work.

Are you sure the font is being loaded? Does it print something in the command prompt? Does the loadFromFile function return true?
Strangely, while I was just checking those features I decided to change the font, downloaded another ttf font file and this one worked fine. I'd already tried this with two fonts before though, so not sure why the first 2 files don't work but this one does  :-\

EDIT* Seems all good now, not quite sure what happened there. Guess those two fonts are damaged in some way. Thanks for replying  ;D

2
Graphics / Re: Text on the screen?
« on: July 11, 2013, 01:03:04 pm »
You are first drawing the text and then the rectangle. So even if the text would be drawn, you draw the rectangle over it.

Also check the loadFromFile line.
font.loadFromFile("Fonts\BRADHTC.ttf");
Backslash is an escape character. You need to replace it with '/' or with '\\' to make it work.

Edit: And isn't a character size of 2 pixels a little small for a text?

I've tried it both ways and the text doesn't display when its before or after the rectangle. Also its size 2 as I was playing around with the size incase it was outside the window or something. It doesn't appear at any size :( 

I changed the backslash to both / and \\ and it doesn't show either

3
Graphics / Text on the screen?
« on: July 11, 2013, 12:38:05 pm »
Hi again,

Think is a graphics issue? Actually got some time to start looking more indepth into SFML 2.0, and was running through some guides and tutorials. I ended up merging a few bits I found to try make something without the aid of the guides completely. However this might be where my errors occurred, I'm trying to get a simple bit of text to display in the window. I've searched these forums and Google, to no avail really. The program runs fine, no errors but the text is simply not there? Maybe another simple issue but I'd love a point in the right direction  :D

#include <SFML\Window.hpp>
#include <SFML\Graphics.hpp>
#include <SFML\System.hpp>

using namespace sf;

int main()
{
        VideoMode videoMode(320,240);
        RenderWindow window(videoMode,"KeyEvent Window");

        //Set objects in the window    
        sf::Font font;
        font.loadFromFile("Fonts\BRADHTC.ttf");

        sf::Text text; 
        text.setString("Hello");
        text.setFont(font);
        text.setCharacterSize(2);
        text.setPosition(30, 30);
        text.setColor(sf::Color::Black);

        RectangleShape rectangle;
        rectangle.setPosition(30,30);
        rectangle.setSize(Vector2f(50, 30));

        rectangle.setFillColor(Color::Green);
        rectangle.setOutlineColor(Color::White);
        rectangle.setOutlineThickness(3);      
        //

        while (window.isOpen())
        {
                window.clear(sf::Color::White);
                window.draw(text);
                window.draw(rectangle);        
                window.display();

                Event event;
                while (window.pollEvent(event))
                {
                        if ( (event.type == Event::Closed) ||
                                ((event.type == Event::KeyPressed) && (event.key.code==Keyboard::Escape)) )
                                window.close();
                        else
                        {
                                if (event.type == Event::KeyPressed)
                                {
                                        switch(event.key.code)
                                        {
                                        case Keyboard::Up: rectangle.move(0, -10);
                                                break;
                                        case Keyboard::Down: rectangle.move(0, 10);
                                                break;
                                        case Keyboard::Left: rectangle.move(-10, 0);
                                                break;
                                        case Keyboard::Right: rectangle.move(10, 0);
                                                break;
                                        }
                                }      
                        }
                }
        }

        return EXIT_SUCCESS;
}
 

If any of this code is a bit messy or unneeded, feel free to point that out aswell but I am still grasping this so don't know all the best ways to do things yet  :P

Thanks to anyone who reads this..

4
General / Re: Sfml-graphics-2.dll is MIA
« on: July 08, 2013, 02:09:54 pm »
"Now compile the project, and if you linked to the dynamic version of SFML, don't forget to copy the SFML DLLs (they are in <sfml-install-path/bin>) to the directory where your compiled executable is. Then run it, and if everything is ok you should see this:"

It's written in the tutorial.I had this problem too :P

Wow, I completely missed that  :-[ , thankyou so much for answering so fast  ;D

5
General / Sfml-graphics-2.dll is MIA [SOLVED]
« on: July 08, 2013, 01:45:45 pm »
*Not sure if this goes in General or Graphics*

Hi guys,

Having a bit of an issue setting up SMFL 32bit for my computer using VS 2012. I'm trying to run the project in the tutorial to test its been added correctly and it says that sfml-graphics-2.dll is missing from my computer. Now I've Googled and searched this forum and found somewhat similar issues, but with no resolution as the posts just died.

This dll didn't come with the download of smfl, so how exactly do I get the dll file and where would I add it to my system so VS can see it?

Kinda new to this so sorry if this is such a simple question  :P

Thanks

Pages: [1]