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

Author Topic: Why wont my code for making text work?  (Read 2936 times)

0 Members and 1 Guest are viewing this topic.

sfmlhelperguy

  • Newbie
  • *
  • Posts: 4
    • View Profile
Why wont my code for making text work?
« on: January 16, 2012, 06:22:44 pm »
Code: [Select]
#include<SFML/Graphics.hpp>
int main()
{
    sf::VideoMode Vmode(640,480,32);
    sf::RenderWindow Window(Vmode,"Hello There");
    sf::Text text("Something");
    while(Window.IsOpened())
    {
        sf::Event Event;
        while(Window.GetEvent(Event))
        {
            if(Event.Type == sf::Event::Closed || Event.Key.Code == sf::Key::Escape)
            {
                Window.Close();
            }
        }
            Window.Clear();
            Window.Draw(text);
            Window.Display();
    }
    return 0;
}

And here are the errors:

Quote
In function 'int main()':
line 6  error: 'Text' is not a member of 'sf'
line 6 error: expected ';' before 'text'
line 18  error: 'text' was not declared in this scope

I dont know what the problem is please help me

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Why wont my code for making text work?
« Reply #1 on: January 16, 2012, 06:48:05 pm »
Are you sure that you have SFML 2.0 headers?
Laurent Gomila - SFML developer

sfmlhelperguy

  • Newbie
  • *
  • Posts: 4
    • View Profile
Why wont my code for making text work?
« Reply #2 on: January 16, 2012, 07:15:15 pm »
Quote from: "Laurent"
Are you sure that you have SFML 2.0 headers?


Idk that's why im asking do I need another header or something because I have every dll I need in my program folder

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Why wont my code for making text work?
« Reply #3 on: January 16, 2012, 08:26:01 pm »
Quote
Idk

Which version of SFML are you using? You must know that ;)
Laurent Gomila - SFML developer

sfmlhelperguy

  • Newbie
  • *
  • Posts: 4
    • View Profile
Why wont my code for making text work?
« Reply #4 on: January 16, 2012, 08:28:52 pm »
Quote from: "Laurent"
Quote
Idk

Which version of SFML are you using? You must know that ;)

version 1.6 from what I see

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Why wont my code for making text work?
« Reply #5 on: January 16, 2012, 08:34:46 pm »
The code in your first message is 2.0. You probably read the wrong documentation or tutorials.
Laurent Gomila - SFML developer

sfmlhelperguy

  • Newbie
  • *
  • Posts: 4
    • View Profile
Why wont my code for making text work?
« Reply #6 on: January 16, 2012, 11:07:42 pm »
Quote from: "Laurent"
The code in your first message is 2.0. You probably read the wrong documentation or tutorials.

Oh really wow so then how do you make text in sfml 2.0?

coolhome

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
Why wont my code for making text work?
« Reply #7 on: January 17, 2012, 04:57:59 am »
Take a look at the example at the link below. It has a perfect example.
http://sfml-dev.org/documentation/2.0/
CoderZilla - Everything Programming

Tex Killer

  • Full Member
  • ***
  • Posts: 242
    • View Profile
Why wont my code for making text work?
« Reply #8 on: January 17, 2012, 06:32:53 am »
Quote from: "sfmlhelperguy"
Quote from: "Laurent"
The code in your first message is 2.0. You probably read the wrong documentation or tutorials.

Oh really wow so then how do you make text in sfml 2.0?


Your code is already designed for SFML2. If you want to know how to make text in SFML 1.6, that is the one you are using, check the 1.6 tutorials on SFML site.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Why wont my code for making text work?
« Reply #9 on: January 17, 2012, 12:27:20 pm »
And if you want to know how to realize it in SFML 2, you should first get SFML 2 ;)

Download it on the GitHub page. There's an installation tutorial that shows you how to build the library with CMake.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: