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

Author Topic: Missing sfml function and classes in sf::view tutorial  (Read 2672 times)

0 Members and 1 Guest are viewing this topic.

Drugdoctor

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Missing sfml function and classes in sf::view tutorial
« on: May 19, 2015, 11:00:32 pm »
I'm new to both SFML and C++ and am working on my second project.  The project IS working, but I've run out of room to display the results and thought I'd look at a tutorial on how to use sf::view so I can scroll the results down below.  The SFML tutorial is a bit sparse and I found this tutorial in GitHub: https://github.com/SFML/SFML/wiki/Tutorial:-Using-View
It claims to be using SFML 2 (I'm using SFML 2.1) and is written for Xcode, while I'm using Code::Blocks 13.12.
The CPP is attached.  I get 3 errors and 3 notes (see attached screenshot jpg).  Is this just bad code, or is there some conversion problem from Xcode to Code::Blocks?  Or am I missing a library?
The errors are: 
line 46 no matching function for call to 'sf::Text::Text(const char [16])'
line 146 two identical errors, 'class sf::RenderWindow' has no member named 'convertCoords'
It's so close!  If this is bad code, does anyone have an idea what it should be?
I'd appreciate your help.

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Missing sfml function and classes in sf::view tutorial
« Reply #1 on: May 19, 2015, 11:09:43 pm »
convertCoords disappeared a long time ago, use mapPixelToCoords.
You can notice that the code on this wiki page already uses mapPixelToCoords but the code in the .zip doesn't. (:()

Ah, and sf::Text doesn't have a constructor with only one string parameter. Moreover, you HAVE to load a font since there isn't any default font anymore.
« Last Edit: May 19, 2015, 11:12:56 pm by G. »

Drugdoctor

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: Missing sfml function and classes in sf::view tutorial
« Reply #2 on: May 20, 2015, 10:46:15 pm »
Thanks so much G.!!
Actually, I still got an error message with mapPixelToCoords, but I realized it is in a console message, so I changed the string and commented out the line.  It now works perfectly after loading a text font.
P.S. I'm really new to this.  Are these emoticons important? If so,  ;D

 

anything