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

Author Topic: How to declare sf::Thread  (Read 4099 times)

0 Members and 1 Guest are viewing this topic.

timo777

  • Newbie
  • *
  • Posts: 37
    • View Profile
How to declare sf::Thread
« on: December 26, 2012, 12:33:59 pm »
I can't get rid of the following thing... When I try to make a member for my class like this:

sf::Thread                              ListenThread;

I can't declare it like this somewhere else:

sf::Thread                              ListenThread(&CMultiplayer::Listen, &Multiplayer);

At the window class, for example, there is a member create() to initalize it. So why it isn't here? I am proberly doing something stupid...  :(

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How to declare sf::Thread
« Reply #1 on: December 26, 2012, 12:50:44 pm »
Always use the constructor initialization list to initialize member variables.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

timo777

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: How to declare sf::Thread
« Reply #2 on: December 26, 2012, 01:01:31 pm »
Thank you very much! I never would have come to that on my own.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How to declare sf::Thread
« Reply #3 on: December 26, 2012, 01:18:11 pm »
I never would have come to that on my own.
You are not supposed to magically discover C++ language features, you should rather have a good book that teaches them ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything