Hi everyone,
I have a problem which I don't know how to solve...
I have to make a game for 3 players, so I have an array of players.
Each of these players can do something (what they can do is defined in a certain function, which contains a while loop to go through the array).
At a certain piont in the loop I know what that specific user is allowed to do (like do option A and option B).
Then I'd normally ask for user input (like in a command line, press 1 to do this, press 2 to do this other thing....)
Now I have to ask for userinput by using Qt, so by clicking or something.
The problem is that it ain't clean to have code of your view in your model (so no Qt code in my C++ code.....).
How do I simply split my functionin two functions and still keep the variables.
I still have to know what the user is allowed to do, or where he's allowed to click
There are variables which I need both before the user input aswell as after the user input.
Can someone help me with this please?
Thanks in advance!
This is the codes, how I would solve it in C++ code.
void MyClass::MyFunction(Myparams){
int a,i;
bool b;
for (i = 0; i < MAXPLAYERS; ++i){
//get info about the players, like which choises they should get or how much they have to pay for something...
//ask for user input (I can't put Qt code here, since that would make my model dependant on one framework/toolkit)
//do the desired action
}
}
void MyClass::MyFunction(Myparams){
int a,i;
bool b;
for (i = 0; i < MAXPLAYERS; ++i){
//get info about the players, like which choises they should get or how much they have to pay for something...
//ask for user input (I can't put Qt code here, since that would make my model dependant on one framework/toolkit)
//do the desired action
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks