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

Author Topic: sf::Thread Constructor Problem  (Read 3425 times)

0 Members and 1 Guest are viewing this topic.

StDH

  • Jr. Member
  • **
  • Posts: 56
  • {⛺.⛺}
    • View Profile
    • Worst ever ^^
sf::Thread Constructor Problem
« on: April 01, 2014, 05:32:05 am »
Hello all, i am new to this forum, but i am working with sfml 1 year or more.

The problem is this:

sf::Thread kb(&gameInputMgr::keyboard, this);
sf::Thread ms(&gameInputMgr::mouse, this);
kb.launch();
ms.launch();

this above is inside :
void gameWindow::run()

Libs are compiled in VC++12 [STATIC]

I have even tried this:
gameInputMgr gInputMgr;

sf::Thread kb(&gInputMgr.keyboard, this);
sf::Thread ms(&gInputMgr.mouse, this);
&
sf::Thread kb(&gInputMgr.keyboard);
sf::Thread ms(&gInputMgr.mouse);

I have no idea whats wrong, there is my output log:

  gameWindow.cpp
D:\Dark Orbit X\_shared\SFML-2.1\SFML/System/Thread.inl(48): error C2064: term does not evaluate to a function taking 1 arguments
          D:\Dark Orbit X\_shared\SFML-2.1\SFML/System/Thread.inl(48) : while compiling class template member function 'void sf::priv::ThreadFunctorWithArg<F,A>::run(void)'
          with
          [
              F=void (__thiscall gameInputMgr::* )(void)
  ,            A=gameWindow *
          ]
          D:\Dark Orbit X\_shared\SFML-2.1\SFML/System/Thread.inl(79) : see reference to class template instantiation 'sf::priv::ThreadFunctorWithArg<F,A>' being compiled
          with
          [
              F=void (__thiscall gameInputMgr::* )(void)
  ,            A=gameWindow *
          ]
          gameWindow.cpp(29) : see reference to function template instantiation 'sf::Thread::Thread<void(__thiscall gameInputMgr::* )(void),gameWindow*>(F,A)' being compiled
          with
          [
              F=void (__thiscall gameInputMgr::* )(void)
  ,            A=gameWindow *
          ]

N3v3r h48 4ny pr0bl3ms w11h 11.
« Last Edit: April 01, 2014, 06:08:20 am by SHADOW_Dark_HACKER »
<StDH> Imagine a girl writing you this: My farts smell good
<Slipxy> married.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sf::Thread Constructor Problem
« Reply #1 on: April 01, 2014, 07:44:39 am »
You pass a member function of gameInputMgr and an instance of gameWindow. You must of course pass an instance of gameInputMgr.
Laurent Gomila - SFML developer

StDH

  • Jr. Member
  • **
  • Posts: 56
  • {⛺.⛺}
    • View Profile
    • Worst ever ^^
Re: sf::Thread Constructor Problem
« Reply #2 on: April 01, 2014, 01:58:23 pm »
You pass a member function of gameInputMgr and an instance of gameWindow. You must of course pass an instance of gameInputMgr.

Thanks for the reply, but how does it look in a code ?
<StDH> Imagine a girl writing you this: My farts smell good
<Slipxy> married.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sf::Thread Constructor Problem
« Reply #3 on: April 01, 2014, 02:02:43 pm »
Replace "this" in your code (which is a gameWindow instance) with the instance of the gameInputMgr class that you must have somewhere around.

If you have no idea about what you're doing, then you should probably not try to use threads.
Laurent Gomila - SFML developer

StDH

  • Jr. Member
  • **
  • Posts: 56
  • {⛺.⛺}
    • View Profile
    • Worst ever ^^
Re: sf::Thread Constructor Problem
« Reply #4 on: April 01, 2014, 02:08:21 pm »
Replace "this" in your code (which is a gameWindow instance) with the instance of the gameInputMgr class that you must have somewhere around.

If you have no idea about what you're doing, then you should probably not try to use threads.

I am sorry what did a say before, but now when i read every word you say, i see what you mean
<StDH> Imagine a girl writing you this: My farts smell good
<Slipxy> married.

 

anything