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

Author Topic: Understanding const sf::Input&  (Read 2129 times)

0 Members and 1 Guest are viewing this topic.

cho9

  • Newbie
  • *
  • Posts: 3
    • View Profile
Understanding const sf::Input&
« on: July 18, 2009, 08:20:19 pm »
Hi,

Can you tell me, why I must make sf::Input Objects as consts.

And what does the '&' after Input mean?

Sorry for me being stupid. I really tried to understand it. Dx

klusark

  • Newbie
  • *
  • Posts: 45
    • View Profile
Understanding const sf::Input&
« Reply #1 on: July 18, 2009, 10:38:33 pm »
It is a const so that the compiler will catch if you accedently reassign it. The & is so that it does not return a copy, but a referance of the original input.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Understanding const sf::Input&
« Reply #2 on: July 19, 2009, 12:11:52 am »
You should learn C++ first, references and const are really basics. SFML is a high-level library, which requires you to know the techniques and constructs it works with.

I can understand if you want to see results as fast as possible, but that's the wrong way. You will certainly come across several problems just because you didn't invest the time to learn the language. And that can be very discouraging.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything