I moved the GameType struct (and the Mode enum) to a separate file, as I will need
to use it in the check_server and check_client functions as well. I also added the
signum function (which was previously in sign.hpp) to this file, since it was the only
function in sign.hpp. Finally, I added a check, that will only display the GUI, if the
user didn't provide any command-line arguments.
floatpaddle_mid_y=(paddle.getRect().y+paddle.getRect().GetHeight())/2.0;/* Middle y value of rectangle */
@ -223,8 +216,8 @@ int main(int argc, char** argv) {
boolgame_started=false;
srand(std::time(NULL));
/* If there were no command-line arguments, the user is prompted in the GUI */
if(argc==1){
/* Display a drop-down menu, to allow user to pick between Single player, server and client. This section of the code uses the raygui library, and is written in C. */
GuiLoadStyleDark();// Load the dark theme style
@ -309,7 +302,10 @@ int main(int argc, char** argv) {
EndDrawing();
}
GameTypetype=check_server(ip_text,port_text);
type=check_server(ip_text,port_text);
free(ip_text);
free(port_text);
}
}
/* Variable to store the response given by the other player */