setup louche en console

This commit is contained in:
MarcEricMartel 2023-10-18 09:59:34 -04:00
parent 2cb7d4c776
commit 0e7b8973e7
4 changed files with 27 additions and 25 deletions

View File

@ -69,7 +69,7 @@ int Connector::Connect(char* srv_addr, std::string name) {
buf = new char[150] {0};
buflen = 150;
int rpack = 0;
int errors = 0;
while (rpack < 2) {
recv(m_sock_tcp, buf, buflen, 0);
@ -89,9 +89,12 @@ int Connector::Connect(char* srv_addr, std::string name) {
++rpack;
break;
default:
std::cout << "Packet invalide." << std::endl;
++errors;
//std::cout << "Packet invalide." << std::endl;
break;
}
if (errors > 100)
return 1;
}
return 0;
}

View File

@ -20,7 +20,6 @@
#include <climits>
#endif
#define NETWORK_TEST false
#define SRV_ADDR "127.0.0.1"
#define COUNTDOWN 300

View File

@ -265,14 +265,14 @@ void Engine::Init() {
m_whoosh[x] = nullptr;
}
#ifdef NETWORK_TEST
if (true) {
std::cout << "Jouer en ligne? [o/N] ";
std::cin >> ch;
std::cout << std::endl;
if (ch == 'o' || ch == 'O') {
std::cout << "Veuillez entrer un nom de joueur: ";
std::getline(std::cin, playname);
std::cin >> playname;
std::cout << std::endl;
if (!m_conn.Init()) {
@ -286,7 +286,7 @@ void Engine::Init() {
}
else std::cout << "Erreur de creation de socket." << std::endl;
}
#endif
}
m_world.SetSeed(seed);

View File

@ -82,11 +82,11 @@ private:
//Menu
enum class GameState { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY };
GameState m_gamestate = GameState::MAIN_MENU;
Texture MenuTitleTexture;
Texture MenuBGTexture;
Texture MenuStartTexture;
Texture MenuQuitTexture;
Texture MenuOptionsTexture;
Texture MenuTitleTexture,
MenuBGTexture,
MenuStartTexture,
MenuQuitTexture,
MenuOptionsTexture;
float m_scale;
float m_time = 0;