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

Author Topic: Beginner mistakes, help me please.  (Read 1958 times)

0 Members and 1 Guest are viewing this topic.

Andrew_sl

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Beginner mistakes, help me please.
« on: July 08, 2012, 07:07:07 pm »
I am a newbie and trying to work with SFML in visual studio 2010. I decided to analyze samples. Do not know how (with the aid of the search) I came across this example.
http://en.sfml-dev.org/forums/index.php?topic=7100.0
I copied the code into my project ... but in the following piece of code


m_shape.SetOrigin(10,10);
m_shape.SetFillColor(sf::Color(255, 0, 255, 255));

ground.RECT.SetOrigin(4000,25);
   ground.RECT.SetFillColor(sf::Color(200,75,20,255));
    ground.SHAPE.SetAsBox(4000.0f/PPM,25.0f/PPM);
    ground.BOD = world.CreateBody(&ground.DEF);
    ground.FIX.shape = &ground.SHAPE;
   ground.FIX.density = .7f;
   ground.FIX.friction = .9f;
    ground.BOD->CreateFixture(&ground.SHAPE,1.0f);

   //text stuff to appear on the page
   sf::Font myFont;
   if (!myFont.LoadFromFile("../res/athena_u.TTF"))
      return EXIT_FAILURE;
    sf::Text Text("FPS", myFont);
    Text.SetCharacterSize(20);
    Text.SetColor(sf::Color(0, 255, 255, 255));
    Text.SetPosition(25,25);
   //added these guys BHN
   sf::Text clearInstructions("Press [Space] to reset");
   sf::Text jumpInstructions("Press [A] to make blocks jump");
   clearInstructions.SetCharacterSize(18);
   jumpInstructions.SetCharacterSize(18);
   clearInstructions.SetColor(sf::Color(200, 55, 100, 255));
   jumpInstructions.SetColor(sf::Color(200, 55, 100, 255));
   clearInstructions.SetPosition(25, 50);
   jumpInstructions.SetPosition(25, 70);

 vs2010  tells me

'SetOrigin' : is not a member of 'sf::RectangleShape'
'SetFillColor' : is not a member of 'sf::RectangleShape'
'LoadFromFile' : is not a member of 'sf::Font'
'SetCharacterSize' : is not a member of 'sf::Text'
'SetColor' : is not a member of 'sf::Text'
'SetPosition' : is not a member of 'sf::Text'
'IsOpen' : is not a member of 'sf::RenderWindow'
'SetRotation' : is not a member of 'sf::RectangleShape'
'SetPosition' : is not a member of 'sf::RectangleShape'

But in the manual also says that these classes have these features.
I use sfml2.0rc.
Please tell me what I'm doing wrong.
Thanks in advance. I hope I described the problem properly.

Midleiro F

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Beginner mistakes, help me please.
« Reply #1 on: July 08, 2012, 07:16:50 pm »
In sfml 2.0 the function names start with a lower case character. So it should be setOrigin(), loadFromFile(), etc...

Andrew_sl

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Beginner mistakes, help me please.
« Reply #2 on: July 09, 2012, 08:49:40 am »
Thanks a lot!

Canvas

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: Beginner mistakes, help me please.
« Reply #3 on: July 09, 2012, 12:30:23 pm »
Also some of the methods are named differently now, the best way to find out is type sf::
then it will come up with the available functions, then sf::functionWanted:: and then it will come up once again with the available functions, if there is any

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Beginner mistakes, help me please.
« Reply #4 on: July 09, 2012, 12:35:58 pm »
... or simply read the online API documentation ...
Laurent Gomila - SFML developer