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

Author Topic: Think This Is A Typo  (Read 4622 times)

0 Members and 1 Guest are viewing this topic.

azoundria

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Think This Is A Typo
« on: January 03, 2014, 11:28:06 pm »
On this page:
http://www.sfml-dev.org/tutorials/2.0/graphics-draw.php

You have this text in the Off-screen drawing section:
sf::Texture& texture = renderTexture.getTexture();

// draw it to the window
sf::Sprite sprite(texture);

I think the ampersand is a typo.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Think This Is A Typo
« Reply #1 on: January 03, 2014, 11:35:39 pm »
It's not.
Back to C++ gamedev with SFML in May 2023

Daddi

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
    • http://foxdev.de/
    • Email
Re: Think This Is A Typo
« Reply #2 on: January 04, 2014, 01:03:44 am »
To be a bit more specific: the & says, that "texture" is a reference, not an actual object :)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Think This Is A Typo
« Reply #3 on: January 04, 2014, 09:41:38 am »
However, sf::RenderTexture::getTexture() returns a const sf::Texture&, therefore it should be a const reference.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: