Hey.
Hab folgendes Problem;
Versuche mich zurzeit an einem kleinen Konsolenspiel, jedoch hab ich das Problem, dass ich nicht aus dem While Loop rauskommen, jedoch einen infinite loop brauche, for funktionierte ebenfalls nicht.
Das Problem ist halt, dass es aus dem Thread nicht mehr raus kommt, jedoch er weiter laufen muss, die Frage ist nun: Wie?
Mfg
Hab folgendes Problem;
Versuche mich zurzeit an einem kleinen Konsolenspiel, jedoch hab ich das Problem, dass ich nicht aus dem While Loop rauskommen, jedoch einen infinite loop brauche, for funktionierte ebenfalls nicht.
Code:
int _tmain(int argc, _TCHAR* argv[])
{
thread StatsT(Stats);
StatsT.join();
cout << "test1" << endl;
cout << "test2" << endl;
hp +23;
getchar();
return 0;
}
void Stats()
{
for(;;)
{
system("cls");
cout << "RPG\n\n";
cout << "Level: " << lvl << endl;
cout << "Aktuelle HP: " << hp << "/" << mhp << endl;
cout << "Erfahrung: " << Exp << "/" << mexp << endl;
cout << "Gold: " << cash << "$" << endl;
cash++;
}
}
Mfg