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

Author Topic: sf::window does not contain a "draw()" function; cannot draw sprites. SFML 2.0  (Read 1491 times)

0 Members and 1 Guest are viewing this topic.

BananaDarras

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Hi all! I was wondered how to draw sprites with SFML 2.0, as the window class does not contain a draw function like 1.6, and many tutorials for 2.0 say it does. Thanks.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
As in SFML 1.6, you must use a sf::RenderWindow, not a sf::Window.
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10190
    • View Profile
    • development blog
    • Email
as the window class does not contain a draw function like 1.6
And how would you've deduced this? Did you're "intelligent" part of your IDE "tell" you this?
Take a look at the example in the documentation, make sure your environment is setup correctly and never trust "intelligent" code look up things, but only trust your compiler.
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

BananaDarras

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Quote
As in SFML 1.6, you must use a sf::RenderWindow, not a sf::Window.

Thanks, I didn't know that you had to use sf::RenderWindow.

Quote
And how would you've deduced this? Did you're "intelligent" part of your IDE "tell" you this?

I am using VS2010 and it said the window.draw() didn't exist even when I tried to compile it, it ends up I had to use sf::RenderWindow instead of sf::Window. I didn't realize that  :-\

Thanks for the help.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10190
    • View Profile
    • development blog
    • Email
I am using VS2010 and it said the window.draw() didn't exist even when I tried to compile it, it ends up I had to use sf::RenderWindow instead of sf::Window. I didn't realize that  :-\
Hasn't been different in SFML 1.6 and all the examples you can find use a sf::RenderWindow. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

 

anything