I'm assuming you're refering to SFML 2.
I guess there are many ways to achive this.
Since you can declare which type you want to pass, you can create the type you want, so it could be your own struct or your own class or just an std::vector, etc...
Another way is to have the variable in the same scope (probably global scope in your case), which needs quite a bit more attetion so you don't run into race conditions. Also keep in mind global variables aren't such a nice code design. For the global scope problem you could make the function a member of a class and then use the member variables (you'll still have to make sure that there are no race conditions).
Yeah sorry i meant 2.0. i think i might be able to do what i need with a new class or possibly a struct, ill check it out unless the std::bind works for what i need
The two easiest solutions are:
1. Use C++11 or boost or tr1
sf::Thread thread(std::bind(&f, a, b, c, d));
2. If you can't use anything of solution 1., then gather the four parameters into one
struct Params
{
...;
...;
...;
...;
};
Params p = {a, b, c, d};
sf::Thread thread(&f, p);
sorry im a bit of a novice programmer in c++ and using the sfml librarys, but im guessing the struct will just gather my 4 parameters into one so it would look something like
struct Param
{
GamePlayer player;
DBManager dbManager;
CameraManager camManager;
};
then for the function im calling for the thread it would be
void TheThreadFunction(Param p)
{
//code for thread belongs here
}
and finally the call to my thread would be (within int main())
Param newParam {activePlayer, activeDBManager, activeCamera}
sf::Thread myThread(&TheThreadFunction, newParam);
myThread.launch();
where activePlayer, activeDBManager, and activeCamera are already set instances of GamePlayer, DBManager, and CameraManager
does this look right?
also what it looks like i just did there the std::bind looks like it basically took care of that for me. Ill play around with it and see how either of those options work out. Thank you