Compare commits
	
		
			7 Commits
		
	
	
		
			InputField
			...
			Améloratio
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					2c73a2ed00 | ||
| 
						 | 
					d444b4de30 | ||
| 
						 | 
					bb100fd5cb | ||
| 
						 | 
					a137666546 | ||
| 
						 | 
					841947bc7a | ||
| 
						 | 
					e3b59e37eb | ||
| 
						 | 
					732f74de91 | 
@@ -1,55 +1,83 @@
 | 
				
			|||||||
#include "chunk.h"
 | 
					#include "chunk.h"
 | 
				
			||||||
#include "world.h"
 | 
					#include "world.h"
 | 
				
			||||||
 | 
					#include <random>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Chunk::Chunk(unsigned int x, unsigned int y, int64_t seed) : m_posX(x), m_posY(y) {
 | 
					Chunk::Chunk(unsigned int x, unsigned int y, int64_t seed) : m_posX(x), m_posY(y) {
 | 
				
			||||||
	//std::ostringstream pos; // V<>rifie l'existence d'un fichier .chunk avec sa position.
 | 
						//std::ostringstream pos; // V<>rifie l'existence d'un fichier .chunk avec sa position.
 | 
				
			||||||
	//pos << CHUNK_PATH << x << '_' << y << ".chunk";
 | 
						//pos << CHUNK_PATH << x << '_' << y << ".chunk";
 | 
				
			||||||
	//std::ifstream input(pos.str(), std::fstream::binary);
 | 
						//std::ifstream input(pos.str(), std::fstream::binary);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//if (input.fail()) {
 | 
						//if (input.fail()) {
 | 
				
			||||||
	OpenSimplexNoise::Noise simplex = OpenSimplexNoise::Noise(seed);
 | 
						OpenSimplexNoise::Noise simplex = OpenSimplexNoise::Noise(seed);
 | 
				
			||||||
	m_blocks.Reset(BTYPE_AIR);
 | 
					 | 
				
			||||||
	int ratio = 0;
 | 
						int ratio = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ratio = x * y % 7;
 | 
						ratio = x * y % 7;
 | 
				
			||||||
 | 
						m_blocks.Reset(BTYPE_AIR);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#pragma region  Montagnes et Grass des montagnes
 | 
				
			||||||
	for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // Montagnes
 | 
						for (int ix = 0; ix < CHUNK_SIZE_X; ++ix)
 | 
				
			||||||
		for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
 | 
							for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
 | 
				
			||||||
			float xnoiz, ynoiz;
 | 
								float xnoiz, ynoiz;
 | 
				
			||||||
			xnoiz = (double)(ix + x * CHUNK_SIZE_X) / 4096.;
 | 
								xnoiz = (double)(ix + x * CHUNK_SIZE_X) / 4796.;
 | 
				
			||||||
			ynoiz = (double)(iz + y * CHUNK_SIZE_Z) / 4096.;
 | 
								ynoiz = (double)(iz + y * CHUNK_SIZE_Z) / 4796.;
 | 
				
			||||||
			double height = 0;
 | 
								double height = 0;
 | 
				
			||||||
			for (int x = 0; x < 39; ++x) {
 | 
								for (int x = 0; x < 39; ++x) {
 | 
				
			||||||
				height += simplex.eval(xnoiz, ynoiz);
 | 
									height += simplex.eval(xnoiz, ynoiz);
 | 
				
			||||||
				height *= .79;
 | 
									height *= .79;
 | 
				
			||||||
				xnoiz *= 1.139;
 | 
									xnoiz *= 1.1305;
 | 
				
			||||||
				ynoiz *= 1.139;
 | 
									ynoiz *= 1.1305;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			height = height * 2000. * simplex.eval((double)(ix + x * CHUNK_SIZE_X) / 512., (double)(iz + y * CHUNK_SIZE_Z) / 512.);
 | 
								height = height * 2000. * simplex.eval((double)(ix + x * CHUNK_SIZE_X) / 512., (double)(iz + y * CHUNK_SIZE_Z) / 512.);
 | 
				
			||||||
			height /= (CHUNK_SIZE_Y / 1.9);
 | 
								height /= (CHUNK_SIZE_Y / 1.9);
 | 
				
			||||||
			height += 15.;
 | 
								height += 15.;
 | 
				
			||||||
			for (int iy = 0; iy <= (int)height % CHUNK_SIZE_Y; ++iy)
 | 
								for (int iy = 0; iy <= (int)height % CHUNK_SIZE_Y; ++iy) {
 | 
				
			||||||
 | 
									if (iy < 20)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										//std::cout << "" << ynoiz << std::endl;
 | 
				
			||||||
 | 
										SetBlock(ix, iy, iz, BTYPE_GRASS, nullptr);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									else if (iy == 20 || iy == 21) {
 | 
				
			||||||
 | 
										double fractionalPart = ynoiz - static_cast<int>(ynoiz);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										if (iy == 20) {
 | 
				
			||||||
 | 
											if (fractionalPart < 0.3) {
 | 
				
			||||||
 | 
												SetBlock(ix, iy, iz, BTYPE_GRASS, nullptr);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
											else {
 | 
				
			||||||
							SetBlock(ix, iy, iz, BTYPE_METAL, nullptr);
 | 
												SetBlock(ix, iy, iz, BTYPE_METAL, nullptr);
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
	for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // Collines
 | 
										}
 | 
				
			||||||
		for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
 | 
										else if (iy == 21) {
 | 
				
			||||||
			float xnoiz, ynoiz;
 | 
											if (fractionalPart < 0.6) {
 | 
				
			||||||
			xnoiz = (double)(ix + x * CHUNK_SIZE_X) / 512.;
 | 
												SetBlock(ix, iy, iz, BTYPE_GRASS, nullptr);
 | 
				
			||||||
			ynoiz = (double)(iz + y * CHUNK_SIZE_Z) / 512.;
 | 
											}
 | 
				
			||||||
			float height = simplex.eval(xnoiz, ynoiz) * 50.f;// +1.f;
 | 
											else {
 | 
				
			||||||
			for (int iy = 0; iy <= (int)height % CHUNK_SIZE_Y; ++iy) {
 | 
												SetBlock(ix, iy, iz, BTYPE_METAL, nullptr);
 | 
				
			||||||
				if (GetBlock(ix, iy, iz) == BTYPE_AIR)
 | 
					 | 
				
			||||||
					SetBlock(ix, iy, iz, BTYPE_GREENGRASS, nullptr);
 | 
					 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
	for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // "Lacs"
 | 
									}
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										SetBlock(ix, iy, iz, BTYPE_METAL, nullptr);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#pragma endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#pragma region Lacs
 | 
				
			||||||
 | 
						for (int ix = 0; ix < CHUNK_SIZE_X; ++ix)
 | 
				
			||||||
		for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
 | 
							for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
 | 
				
			||||||
			for (int iy = 0; iy < 13; ++iy) {
 | 
								for (int iy = 0; iy < 13; ++iy) {
 | 
				
			||||||
				if (GetBlock(ix, iy, iz) == BTYPE_AIR)
 | 
									if (iy < 5 && GetBlock(ix, iy, iz) == BTYPE_AIR) {
 | 
				
			||||||
 | 
										SetBlock(ix, iy, iz, BTYPE_ICE, nullptr);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									else if (iy >= 5 && GetBlock(ix, iy, iz) == BTYPE_AIR) {
 | 
				
			||||||
					SetBlock(ix, iy, iz, BTYPE_ICE, nullptr);
 | 
										SetBlock(ix, iy, iz, BTYPE_ICE, nullptr);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					#pragma endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//int rnd = rand() % 15;
 | 
						//int rnd = rand() % 15;
 | 
				
			||||||
	if (ratio == 1)
 | 
						if (ratio == 1)
 | 
				
			||||||
@@ -81,38 +109,146 @@ Chunk::Chunk(unsigned int x, unsigned int y, int64_t seed) : m_posX(x), m_posY(y
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // "Arbres"
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#pragma region Arbre
 | 
				
			||||||
 | 
						double valeurRnd = 0;
 | 
				
			||||||
 | 
						int treeheight = 10;
 | 
				
			||||||
 | 
						int lastTreeX = -1;
 | 
				
			||||||
 | 
						int lastTreeZ = -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int minDistanceBetweenTrees = 10; // Définir la distance minimale entre les arbres
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) {
 | 
				
			||||||
 | 
							for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
 | 
				
			||||||
 | 
								if (GetBlock(ix, 0, iz) != BTYPE_ICE) {
 | 
				
			||||||
 | 
									float xnoiz = (double)(ix + x * CHUNK_SIZE_X) / 4796.;
 | 
				
			||||||
 | 
									float ynoiz = (double)(iz + y * CHUNK_SIZE_Z) / 4796.;
 | 
				
			||||||
 | 
									double height = 0;
 | 
				
			||||||
 | 
									for (int i = 0; i < 39; ++i) {
 | 
				
			||||||
 | 
										height += simplex.eval(xnoiz, ynoiz);
 | 
				
			||||||
 | 
										height *= .79;
 | 
				
			||||||
 | 
										xnoiz *= 1.1305;
 | 
				
			||||||
 | 
										ynoiz *= 1.1305;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									height = height * 2000. * simplex.eval((double)(ix + x * CHUNK_SIZE_X) / 512., (double)(iz + y * CHUNK_SIZE_Z) / 512.);
 | 
				
			||||||
 | 
									height /= (CHUNK_SIZE_Y / 1.9);
 | 
				
			||||||
 | 
									height += 15.;
 | 
				
			||||||
 | 
									if (GetBlock(ix, (int)height, iz) == BTYPE_GRASS || (GetBlock(ix, (int)height, iz) == BTYPE_METAL)) {
 | 
				
			||||||
 | 
										valeurRnd = simplex.eval(xnoiz, ynoiz);
 | 
				
			||||||
 | 
										int distanceThreshold = 20;
 | 
				
			||||||
 | 
										// Vérifie si l'emplacement n'est pas à l'intérieur des lacs
 | 
				
			||||||
 | 
										bool isInsideLake = false;
 | 
				
			||||||
 | 
										for (int iy = 0; iy < 13; ++iy) {
 | 
				
			||||||
 | 
											if (GetBlock(ix, iy, iz) == BTYPE_ICE) {
 | 
				
			||||||
 | 
												isInsideLake = true;
 | 
				
			||||||
 | 
												break;
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										if (!isInsideLake && ((valeurRnd > -0.4 && valeurRnd < -0.38) || (valeurRnd > -0.35 && valeurRnd < -0.31)
 | 
				
			||||||
 | 
											|| (valeurRnd > 0.3 && valeurRnd < 0.32) || (valeurRnd > 0.37 && valeurRnd < 0.39))
 | 
				
			||||||
 | 
											) {
 | 
				
			||||||
 | 
											if (lastTreeX == -1 || abs(ix - lastTreeX) > minDistanceBetweenTrees || abs(iz - lastTreeZ) > minDistanceBetweenTrees) {
 | 
				
			||||||
 | 
												if (valeurRnd < 0.1)
 | 
				
			||||||
 | 
													treeheight = 10;
 | 
				
			||||||
 | 
												else {
 | 
				
			||||||
 | 
													treeheight = valeurRnd * 20;
 | 
				
			||||||
 | 
													if (treeheight < 5)
 | 
				
			||||||
 | 
														treeheight = 5;
 | 
				
			||||||
 | 
												}
 | 
				
			||||||
 | 
												PlaceTree(ix, height, iz, treeheight);
 | 
				
			||||||
 | 
												lastTreeX = ix;
 | 
				
			||||||
 | 
												lastTreeZ = iz;
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					#pragma endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						//else {
 | 
				
			||||||
 | 
						//	input.seekg(0, std::ios_base::end);
 | 
				
			||||||
 | 
						//	int size = input.tellg();
 | 
				
			||||||
 | 
						//	input.seekg(0, std::ios_base::beg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						//	char data[CHUNK_SIZE_X * CHUNK_SIZE_Y * CHUNK_SIZE_Z];
 | 
				
			||||||
 | 
						//	input.read(data, size);
 | 
				
			||||||
 | 
						//	input.close();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						//	for (int ix = 0; ix < CHUNK_SIZE_X; ++ix)
 | 
				
			||||||
 | 
						//		for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz)
 | 
				
			||||||
 | 
						//			for (int iy = 0; iy < CHUNK_SIZE_Y; ++iy)
 | 
				
			||||||
 | 
						//				m_blocks.Set(ix, iy, iz, data[ix + (iz * CHUNK_SIZE_X) + (iy * CHUNK_SIZE_Z * CHUNK_SIZE_X)]);
 | 
				
			||||||
 | 
						//}*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						//for (int ix = 0; ix < CHUNK_SIZE_X; ++ix) // Collines
 | 
				
			||||||
//	for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
 | 
					//	for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz) {
 | 
				
			||||||
//		float xnoiz, ynoiz;
 | 
					//		float xnoiz, ynoiz;
 | 
				
			||||||
	//        xnoiz = (double)(iz * CHUNK_SIZE_Y + x * CHUNK_SIZE_X) / 256.;
 | 
					//		xnoiz = (double)(ix + x * CHUNK_SIZE_X) / 512.;
 | 
				
			||||||
	//        ynoiz = (double)(ix * CHUNK_SIZE_Y + y * CHUNK_SIZE_Z) / 256.;
 | 
					//		ynoiz = (double)(iz + y * CHUNK_SIZE_Z) / 512.;
 | 
				
			||||||
	//        bool tree = (int)(abs(simplex.eval(xnoiz, ynoiz)) * 17933.f) % CHUNK_SIZE_Y > 126 ? true : false;
 | 
					//		float height = simplex.eval(xnoiz, ynoiz) * 50.f;// +1.f;
 | 
				
			||||||
	//        for (int iy = 0; iy < CHUNK_SIZE_Y - 10; ++iy)
 | 
					//		for (int iy = 0; iy <= (int)height % CHUNK_SIZE_Y; ++iy) {
 | 
				
			||||||
	//            if (GetBlock(ix, iy, iz) == BTYPE_AIR)
 | 
					//			if (iy < 10 && GetBlock(ix, iy, iz) == BTYPE_AIR) {
 | 
				
			||||||
	//                if (GetBlock(ix, iy - 1, iz) == BTYPE_GRASS)
 | 
					//				SetBlock(ix, iy, iz, BTYPE_METAL, nullptr); // Collines
 | 
				
			||||||
	//                    if (tree) {
 | 
					//			}
 | 
				
			||||||
	//                        for (int i = 0; i < (int)(abs(simplex.eval(xnoiz, ynoiz) * 4)) % 42 + 1; ++i)
 | 
					//			else if (iy >= 10 && GetBlock(ix, iy, iz) == BTYPE_AIR) {
 | 
				
			||||||
	//                            SetBlock(ix, iy + i, iz, BTYPE_DIRT, nullptr);
 | 
					//				SetBlock(ix, iy, iz, BTYPE_GRASS, nullptr); // Grass des collines
 | 
				
			||||||
	//                        break;
 | 
					//			}
 | 
				
			||||||
//		}
 | 
					//		}
 | 
				
			||||||
//	}
 | 
					//	}
 | 
				
			||||||
/* }
 | 
					 | 
				
			||||||
else {
 | 
					 | 
				
			||||||
	input.seekg(0, std::ios_base::end);
 | 
					 | 
				
			||||||
	int size = input.tellg();
 | 
					 | 
				
			||||||
	input.seekg(0, std::ios_base::beg);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	char data[CHUNK_SIZE_X * CHUNK_SIZE_Y * CHUNK_SIZE_Z];
 | 
					 | 
				
			||||||
	input.read(data, size);
 | 
					 | 
				
			||||||
	input.close();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (int ix = 0; ix < CHUNK_SIZE_X; ++ix)
 | 
					 | 
				
			||||||
		for (int iz = 0; iz < CHUNK_SIZE_Z; ++iz)
 | 
					 | 
				
			||||||
			for (int iy = 0; iy < CHUNK_SIZE_Y; ++iy)
 | 
					 | 
				
			||||||
				m_blocks.Set(ix, iy, iz, data[ix + (iz * CHUNK_SIZE_X) + (iy * CHUNK_SIZE_Z * CHUNK_SIZE_X)]);
 | 
					 | 
				
			||||||
}*/
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Chunk::PlaceTree(int x, int y, int z, int height) {
 | 
				
			||||||
 | 
						// Vérifie si les coordonnées x, y, z sont dans les limites du chunk
 | 
				
			||||||
 | 
						if (x < 0 || x >= CHUNK_SIZE_X || y < 0 || y >= CHUNK_SIZE_Y || z < 0 || z >= CHUNK_SIZE_Z) {
 | 
				
			||||||
 | 
							// Coordonnées hors limites du chunk, sortie anticipée pour éviter tout accès non valide
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Place la tige de l'arbre
 | 
				
			||||||
 | 
						for (int iy = 0; iy < height + 1; ++iy) {
 | 
				
			||||||
 | 
							if (y + iy < CHUNK_SIZE_Y) { // Vérifie si la hauteur est à l'intérieur des limites du chunk
 | 
				
			||||||
 | 
								SetBlock(x, y + iy, z, BTYPE_DIRT, nullptr);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Place les feuilles de l'arbre
 | 
				
			||||||
 | 
						int foliageHeight = height / 2;
 | 
				
			||||||
 | 
						for (int dy = 0; dy < foliageHeight; ++dy) {
 | 
				
			||||||
 | 
							for (int dx = -4; dx <= 4; ++dx) {
 | 
				
			||||||
 | 
								for (int dz = -4; dz <= 4; ++dz) {
 | 
				
			||||||
 | 
									// Vérifie que les coordonnées se trouvent à l'intérieur des limites du chunk
 | 
				
			||||||
 | 
									if (x + dx >= 0 && x + dx < CHUNK_SIZE_X && y + height + dy >= 0 && y + height + dy < CHUNK_SIZE_Y &&
 | 
				
			||||||
 | 
										z + dz >= 0 && z + dz < CHUNK_SIZE_Z) {
 | 
				
			||||||
 | 
										// Vérifie si le bloc est à une distance acceptable du centre des feuilles pour les placer
 | 
				
			||||||
 | 
										double distanceSquared = dx * dx + dy * dy + dz * dz;
 | 
				
			||||||
 | 
										if (distanceSquared < 20) {
 | 
				
			||||||
 | 
											SetBlock(x + dx, y + height + dy, z + dz, BTYPE_GREENGRASS, nullptr);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Chunk::~Chunk() {
 | 
					Chunk::~Chunk() {
 | 
				
			||||||
	/*if (m_isModified) {
 | 
						/*if (m_isModified) {
 | 
				
			||||||
		char data[CHUNK_SIZE_X * CHUNK_SIZE_Y * CHUNK_SIZE_Z];
 | 
							char data[CHUNK_SIZE_X * CHUNK_SIZE_Y * CHUNK_SIZE_Z];
 | 
				
			||||||
@@ -139,7 +275,7 @@ void Chunk::RemoveBlock(int x, int y, int z, World* world) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void Chunk::SetBlock(int x, int y, int z, BlockType type, World* world) {
 | 
					void Chunk::SetBlock(int x, int y, int z, BlockType type, World* world) {
 | 
				
			||||||
	m_blocks.Set(x, y, z, type);
 | 
						m_blocks.Set(x, y, z, type);
 | 
				
			||||||
	if (world) CheckNeighbors(x, z, world); // Si nullptr, ne pas v<>rifier les chunks voisines.
 | 
						if (world) CheckNeighbors(x, z, world); // Si nullptr, ne pas v<>rifier les chunks voisines.
 | 
				
			||||||
	m_isDirty = true;
 | 
						m_isDirty = true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -167,6 +303,10 @@ void Chunk::CheckNeighbors(unsigned int x, unsigned int z, World* world) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void Chunk::GetPosition(unsigned int& x, unsigned int& y) const { x = m_posX; y = m_posY; }
 | 
					void Chunk::GetPosition(unsigned int& x, unsigned int& y) const { x = m_posX; y = m_posY; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Chunk::IsDirty() const { return m_isDirty; }
 | 
					bool Chunk::IsDirty() const { return m_isDirty; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Chunk::MakeDirty() { m_isDirty = true; }
 | 
					void Chunk::MakeDirty() { m_isDirty = true; }
 | 
				
			||||||
@@ -178,28 +318,8 @@ void Chunk::MakeModified() { m_isModified = true; }
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void Chunk::Structure(int x, int y, int z,int height)
 | 
					void Chunk::Structure(int x, int y, int z,int height)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (int i = 0; i < height; i++)
 | 
						for (int i = 0; i < height; i++)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		SetBlock(x, i + y, z, BTYPE_GRASS, nullptr);
 | 
							SetBlock(x, i + y, z, BTYPE_GRASS, nullptr);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,6 +27,7 @@ class Chunk {
 | 
				
			|||||||
        BlockType GetBlock(int x, int y, int z);
 | 
					        BlockType GetBlock(int x, int y, int z);
 | 
				
			||||||
        void CheckNeighbors(unsigned int x, unsigned int z, World* world);
 | 
					        void CheckNeighbors(unsigned int x, unsigned int z, World* world);
 | 
				
			||||||
        void GetPosition(unsigned int& x, unsigned int& y) const;
 | 
					        void GetPosition(unsigned int& x, unsigned int& y) const;
 | 
				
			||||||
 | 
					        void PlaceTree(int x, int y, int z, int height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void Structure(int x, int y, int z, int height);
 | 
					        void Structure(int x, int y, int z, int height);
 | 
				
			||||||
        bool IsDirty() const;
 | 
					        bool IsDirty() const;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,7 +39,6 @@
 | 
				
			|||||||
enum GameState { 
 | 
					enum GameState { 
 | 
				
			||||||
	MAIN_MENU, 
 | 
						MAIN_MENU, 
 | 
				
			||||||
	SPLASH,
 | 
						SPLASH,
 | 
				
			||||||
	LOBBY,
 | 
					 | 
				
			||||||
	OPTIONS,
 | 
						OPTIONS,
 | 
				
			||||||
	QUIT, 
 | 
						QUIT, 
 | 
				
			||||||
	PLAY, 
 | 
						PLAY, 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,12 +70,61 @@ void Engine::Init() {
 | 
				
			|||||||
		m_whoosh[x] = nullptr;
 | 
							m_whoosh[x] = nullptr;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char* ch = new char[2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						std::cout << "Jouer en ligne? [o/N] ";
 | 
				
			||||||
 | 
						std::cin.getline(ch, 2);
 | 
				
			||||||
 | 
						std::cout << std::endl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (*ch == 'o' || *ch == 'O') {
 | 
				
			||||||
 | 
							char* input = new char[32];
 | 
				
			||||||
 | 
							std::string playname, srvname;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							while (playname.size() < 1) {
 | 
				
			||||||
 | 
								std::cout << "Veuillez entrer un nom de joueur: ";
 | 
				
			||||||
 | 
								std::cin.getline(input, 32);
 | 
				
			||||||
 | 
								std::cout << std::endl;
 | 
				
			||||||
 | 
								playname = input;
 | 
				
			||||||
 | 
								if (playname.size() < 1 || playname.size() > 32)
 | 
				
			||||||
 | 
									std::puts("Nom invalide.");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							while (srvname.size() < 1) {
 | 
				
			||||||
 | 
								std::cout << "Veuillez entrer une adresse de serveur: ";
 | 
				
			||||||
 | 
								std::cin.getline(input, 32);
 | 
				
			||||||
 | 
								std::cout << std::endl;
 | 
				
			||||||
 | 
								srvname = input;
 | 
				
			||||||
 | 
								if (srvname.size() < 1 || srvname.size() > 32)
 | 
				
			||||||
 | 
									std::puts("Adresse serveur invalide.");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							delete[] input;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (!m_conn.Init()) {
 | 
				
			||||||
 | 
								if (!m_conn.Connect(srvname.c_str(), playname)) {
 | 
				
			||||||
 | 
									// setup jeu en reseau.
 | 
				
			||||||
 | 
									std::cout << "ID recu du serveur: " << std::to_string(m_conn.getId()) << "!" << std::endl;
 | 
				
			||||||
 | 
									std::cout << "Seed recu du serveur: " << std::to_string(m_conn.getSeed()) << "!" << std::endl;
 | 
				
			||||||
 | 
									m_player = Player(m_conn.getOrigin().position);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									for (auto& [key, player] : m_conn.m_players)
 | 
				
			||||||
 | 
										m_players[key] = new RemotePlayer(player);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									seed = m_conn.getSeed();
 | 
				
			||||||
 | 
									m_networkgame = true;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								else std::cout << "Erreur de connexion." << std::endl;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else std::cout << "Erreur de creation de socket." << std::endl;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						delete[] ch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m_world.SetSeed(seed);
 | 
						m_world.SetSeed(seed);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Init Chunks
 | 
						// Init Chunks
 | 
				
			||||||
	m_world.GetChunks().Reset(nullptr);
 | 
						m_world.GetChunks().Reset(nullptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m_startTime = std::chrono::high_resolution_clock::now();
 | 
						m_startTime = std::chrono::high_resolution_clock::now();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						m_remotePlayer.SetPosition(Vector3f(.5, CHUNK_SIZE_Y + 10., .5));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Engine::DeInit() {}
 | 
					void Engine::DeInit() {}
 | 
				
			||||||
@@ -87,9 +136,8 @@ void Engine::LoadResource() {
 | 
				
			|||||||
	LoadTexture(m_textureGun, TEXTURE_PATH "gun01.png", false);
 | 
						LoadTexture(m_textureGun, TEXTURE_PATH "gun01.png", false);
 | 
				
			||||||
	LoadTexture(m_texturePovGun, TEXTURE_PATH "GUN.png", false);
 | 
						LoadTexture(m_texturePovGun, TEXTURE_PATH "GUN.png", false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	LoadTexture(m_textureLobbyMenu, TEXTURE_PATH "menus/backgrounds/bgLobby.png", false);
 | 
					 | 
				
			||||||
	LoadTexture(m_textureMainMenu, TEXTURE_PATH "menus/backgrounds/bgMainMenu.png", false);
 | 
						LoadTexture(m_textureMainMenu, TEXTURE_PATH "menus/backgrounds/bgMainMenu.png", false);
 | 
				
			||||||
	//LoadTexture(m_texturePauseMenu, TEXTURE_PATH "menus/backgrounds/bgPause.png", false);
 | 
						LoadTexture(m_texturePauseMenu, TEXTURE_PATH "menus/backgrounds/bgPause.png", false);
 | 
				
			||||||
	LoadTexture(m_textureOptionsMenu, TEXTURE_PATH "menus/backgrounds/bgOptions.png", false);
 | 
						LoadTexture(m_textureOptionsMenu, TEXTURE_PATH "menus/backgrounds/bgOptions.png", false);
 | 
				
			||||||
	LoadTexture(m_textureSplashScreen, TEXTURE_PATH "menus/backgrounds/bgSplash.png", false);
 | 
						LoadTexture(m_textureSplashScreen, TEXTURE_PATH "menus/backgrounds/bgSplash.png", false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -107,9 +155,6 @@ void Engine::LoadResource() {
 | 
				
			|||||||
	LoadTexture(m_textureOptSensitivity, TEXTURE_PATH "menus/buttons/options/optSensitivity.png", false);
 | 
						LoadTexture(m_textureOptSensitivity, TEXTURE_PATH "menus/buttons/options/optSensitivity.png", false);
 | 
				
			||||||
	LoadTexture(m_textureOptSfx, TEXTURE_PATH "menus/buttons/options/optSfx.png", false);
 | 
						LoadTexture(m_textureOptSfx, TEXTURE_PATH "menus/buttons/options/optSfx.png", false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	LoadTexture(m_textureLobbyServer, TEXTURE_PATH "menus/labels/labelServer.png", false);
 | 
					 | 
				
			||||||
	LoadTexture(m_textureLobbyIdentify, TEXTURE_PATH "menus/labels/labelIdentify.png", false);
 | 
					 | 
				
			||||||
	LoadTexture(m_textureHd, TEXTURE_PATH "menus/labels/labelHd.png", false);
 | 
					 | 
				
			||||||
	LoadTexture(m_textureHd, TEXTURE_PATH "menus/labels/labelHd.png", false);
 | 
						LoadTexture(m_textureHd, TEXTURE_PATH "menus/labels/labelHd.png", false);
 | 
				
			||||||
	LoadTexture(m_textureFhd, TEXTURE_PATH "menus/labels/labelFhd.png", false);
 | 
						LoadTexture(m_textureFhd, TEXTURE_PATH "menus/labels/labelFhd.png", false);
 | 
				
			||||||
	LoadTexture(m_textureQhd, TEXTURE_PATH "menus/labels/labelQhd.png", false);
 | 
						LoadTexture(m_textureQhd, TEXTURE_PATH "menus/labels/labelQhd.png", false);
 | 
				
			||||||
@@ -123,8 +168,8 @@ void Engine::LoadResource() {
 | 
				
			|||||||
	LoadTexture(m_textureMenuQuit, TEXTURE_PATH "menus/buttons/main/mainQuit.png", false);
 | 
						LoadTexture(m_textureMenuQuit, TEXTURE_PATH "menus/buttons/main/mainQuit.png", false);
 | 
				
			||||||
	LoadTexture(m_textureMenuSingle, TEXTURE_PATH "menus/buttons/main/mainSingle.png", false);
 | 
						LoadTexture(m_textureMenuSingle, TEXTURE_PATH "menus/buttons/main/mainSingle.png", false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	TextureAtlas::TextureIndex texDirtIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal3.png");
 | 
						TextureAtlas::TextureIndex texDirtIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal2.png");
 | 
				
			||||||
	TextureAtlas::TextureIndex texIceIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal2.png");
 | 
						TextureAtlas::TextureIndex texIceIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal3.png");
 | 
				
			||||||
	TextureAtlas::TextureIndex texGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "grass.png");
 | 
						TextureAtlas::TextureIndex texGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "grass.png");
 | 
				
			||||||
	TextureAtlas::TextureIndex texMetalIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "dirt.png");
 | 
						TextureAtlas::TextureIndex texMetalIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "dirt.png");
 | 
				
			||||||
	TextureAtlas::TextureIndex texGreenGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "greengrass.png");
 | 
						TextureAtlas::TextureIndex texGreenGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "greengrass.png");
 | 
				
			||||||
@@ -505,10 +550,14 @@ void Engine::DisplayPovGun() {
 | 
				
			|||||||
	glLoadIdentity();
 | 
						glLoadIdentity();
 | 
				
			||||||
	glTranslated(xTranslation, 0, 0);
 | 
						glTranslated(xTranslation, 0, 0);
 | 
				
			||||||
	glBegin(GL_QUADS);
 | 
						glBegin(GL_QUADS);
 | 
				
			||||||
	glTexCoord2f(0, 0);		glVertex2i(0, 0);
 | 
						glTexCoord2f(0, 0);
 | 
				
			||||||
	glTexCoord2f(1, 0);		glVertex2i(quadWidth, 0);
 | 
						glVertex2i(0, 0);
 | 
				
			||||||
	glTexCoord2f(1, 1);		glVertex2i(quadWidth, quadHeight);
 | 
						glTexCoord2f(1, 0);
 | 
				
			||||||
	glTexCoord2f(0, 1);		glVertex2i(0, quadHeight);
 | 
						glVertex2i(quadWidth, 0);
 | 
				
			||||||
 | 
						glTexCoord2f(1, 1);
 | 
				
			||||||
 | 
						glVertex2i(quadWidth, quadHeight);
 | 
				
			||||||
 | 
						glTexCoord2f(0, 1);
 | 
				
			||||||
 | 
						glVertex2i(0, quadHeight);
 | 
				
			||||||
	glEnd();
 | 
						glEnd();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Reset du blend function
 | 
						// Reset du blend function
 | 
				
			||||||
@@ -575,25 +624,6 @@ int Engine::GetOptionsChoice() {
 | 
				
			|||||||
	return m_selectedOption;
 | 
						return m_selectedOption;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Engine::StartMultiplayerGame() {
 | 
					 | 
				
			||||||
	if (!m_conn.Init()) {
 | 
					 | 
				
			||||||
		if (!m_conn.Connect(m_serverAddr.c_str(), m_username)) {
 | 
					 | 
				
			||||||
			// setup jeu en reseau.
 | 
					 | 
				
			||||||
			std::cout << "ID recu du serveur: " << std::to_string(m_conn.getId()) << "!" << std::endl;
 | 
					 | 
				
			||||||
			std::cout << "Seed recu du serveur: " << std::to_string(m_conn.getSeed()) << "!" << std::endl;
 | 
					 | 
				
			||||||
			m_player = Player(m_conn.getOrigin().position);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			for (auto& [key, player] : m_conn.m_players)
 | 
					 | 
				
			||||||
				m_players[key] = new RemotePlayer(player);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			//seed = m_conn.getSeed();
 | 
					 | 
				
			||||||
			m_networkgame = true;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		else std::cout << "Erreur de connexion." << std::endl;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else std::cout << "Erreur de creation de socket." << std::endl;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void Engine::DisplayInfo(float elapsedTime, BlockType bloc) {
 | 
					void Engine::DisplayInfo(float elapsedTime, BlockType bloc) {
 | 
				
			||||||
	m_textureFont.Bind();
 | 
						m_textureFont.Bind();
 | 
				
			||||||
	std::ostringstream ss;
 | 
						std::ostringstream ss;
 | 
				
			||||||
@@ -679,81 +709,15 @@ void Engine::DisplaySplashScreen() {
 | 
				
			|||||||
	glPopMatrix();
 | 
						glPopMatrix();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Engine::DisplayLobbyMenu(float elapsedTime) {
 | 
					void Engine::DisplayPauseMenu() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GLint viewport[4];
 | 
						m_texturePauseMenu.Bind();
 | 
				
			||||||
	glGetIntegerv(GL_VIEWPORT, viewport);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	glDisable(GL_DEPTH_TEST);
 | 
					 | 
				
			||||||
	glEnable(GL_BLEND);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	glMatrixMode(GL_PROJECTION);
 | 
					 | 
				
			||||||
	glPushMatrix();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	glLoadIdentity();
 | 
					 | 
				
			||||||
	glOrtho(0, Width(), 0, Height(), -1, 1);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	glMatrixMode(GL_MODELVIEW);
 | 
					 | 
				
			||||||
	glPushMatrix();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	m_textureLobbyMenu.Bind();
 | 
					 | 
				
			||||||
	glBegin(GL_QUADS);
 | 
						glBegin(GL_QUADS);
 | 
				
			||||||
	glTexCoord2f(0, 0);	glVertex2i(0, 0);
 | 
						glTexCoord2f(0, 0);	glVertex2i(0, 0);
 | 
				
			||||||
	glTexCoord2f(1, 0);	glVertex2i(Width(), 0);
 | 
						glTexCoord2f(1, 0);	glVertex2i(Width(), 0);
 | 
				
			||||||
	glTexCoord2f(1, 1);	glVertex2i(Width(), Height());
 | 
						glTexCoord2f(1, 1);	glVertex2i(Width(), Height());
 | 
				
			||||||
	glTexCoord2f(0, 1); glVertex2i(0, Height());
 | 
						glTexCoord2f(0, 1); glVertex2i(0, Height());
 | 
				
			||||||
	glEnd();
 | 
						glEnd();
 | 
				
			||||||
 | 
					 | 
				
			||||||
	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (m_settingUsername) {
 | 
					 | 
				
			||||||
		SetPlayerUsername(elapsedTime);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else if (m_settingServer) {
 | 
					 | 
				
			||||||
		SetServerAddress(elapsedTime);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	glEnable(GL_DEPTH_TEST);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	glMatrixMode(GL_PROJECTION);
 | 
					 | 
				
			||||||
	glPopMatrix();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	glMatrixMode(GL_MODELVIEW);
 | 
					 | 
				
			||||||
	glPopMatrix();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void Engine::SetPlayerUsername(float elapsedTime) {
 | 
					 | 
				
			||||||
	m_textureLobbyIdentify.Bind();
 | 
					 | 
				
			||||||
	glBegin(GL_QUADS);
 | 
					 | 
				
			||||||
	glTexCoord2f(0, 0); glVertex2i(Width() * 0.6, Height() * 0.75);
 | 
					 | 
				
			||||||
	glTexCoord2f(1, 0); glVertex2i(Width() * 0.975, Height() * 0.75);
 | 
					 | 
				
			||||||
	glTexCoord2f(1, 1); glVertex2i(Width() * 0.975, Height() * 0.95);
 | 
					 | 
				
			||||||
	glTexCoord2f(0, 1); glVertex2i(Width() * 0.6, Height() * 0.95);
 | 
					 | 
				
			||||||
	glEnd();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
 | 
					 | 
				
			||||||
	HandlePlayerInput(elapsedTime);
 | 
					 | 
				
			||||||
	glDisable(GL_BLEND);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void Engine::SetServerAddress(float elapsedTime) {
 | 
					 | 
				
			||||||
	m_textureLobbyServer.Bind();
 | 
					 | 
				
			||||||
	glBegin(GL_QUADS);
 | 
					 | 
				
			||||||
	glTexCoord2f(0, 0); glVertex2i(Width() * 0.6, Height() * 0.75);
 | 
					 | 
				
			||||||
	glTexCoord2f(1, 0); glVertex2i(Width() * 0.975, Height() * 0.75);
 | 
					 | 
				
			||||||
	glTexCoord2f(1, 1); glVertex2i(Width() * 0.975, Height() * 0.95);
 | 
					 | 
				
			||||||
	glTexCoord2f(0, 1); glVertex2i(Width() * 0.6, Height() * 0.95);
 | 
					 | 
				
			||||||
	glEnd();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
 | 
					 | 
				
			||||||
	HandlePlayerInput(elapsedTime);
 | 
					 | 
				
			||||||
	glDisable(GL_BLEND);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Engine::DisplayMainMenu() {
 | 
					void Engine::DisplayMainMenu() {
 | 
				
			||||||
@@ -1191,19 +1155,16 @@ void Engine::Render(float elapsedTime) {
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (m_gamestate == GameState::LOBBY) {
 | 
						if (m_gamestate == GameState::PAUSE) {
 | 
				
			||||||
		DisplayLobbyMenu(elapsedTime);
 | 
							DisplayPauseMenu();
 | 
				
			||||||
		if (m_multiReady) {
 | 
					 | 
				
			||||||
			StartMultiplayerGame();
 | 
					 | 
				
			||||||
			std::cout << "Starting multiplayer game reached" << std::endl;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (m_gamestate == GameState::PLAY) {
 | 
						if (m_gamestate == GameState::PLAY) {
 | 
				
			||||||
		HideCursor();
 | 
							HideCursor();
 | 
				
			||||||
		CenterMouse();
 | 
							CenterMouse(); //D<>placement de centermouse dans l'action de jouer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							//static float gameTime = elapsedTime;
 | 
				
			||||||
		static irrklang::ISound* step; // Pour les sons de pas.
 | 
							static irrklang::ISound* step; // Pour les sons de pas.
 | 
				
			||||||
		static float pollTime = 0;
 | 
							static float pollTime = 0;
 | 
				
			||||||
		static float bulletTime = 0;
 | 
							static float bulletTime = 0;
 | 
				
			||||||
@@ -1489,11 +1450,9 @@ void Engine::DrawSlider(float centerX, float centerY, float value, float minVal,
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Engine::KeyPressEvent(unsigned char key) {
 | 
					void Engine::KeyPressEvent(unsigned char key) {
 | 
				
			||||||
	if (m_gamestate == LOBBY) {
 | 
					 | 
				
			||||||
		m_inputChar = SimulateKeyboard(key);
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	switch (key) {
 | 
						switch (key) {
 | 
				
			||||||
	case 0: // A - Gauche
 | 
						case 0: // A - Gauche
 | 
				
			||||||
		if (!m_keyA) {
 | 
							if (!m_keyA) {
 | 
				
			||||||
@@ -1574,12 +1533,6 @@ void Engine::KeyPressEvent(unsigned char key) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Engine::KeyReleaseEvent(unsigned char key) {
 | 
					void Engine::KeyReleaseEvent(unsigned char key) {
 | 
				
			||||||
	if (m_gamestate == LOBBY) {
 | 
					 | 
				
			||||||
		if (key == 38) {
 | 
					 | 
				
			||||||
			m_keyShift = false;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	switch (key) {
 | 
						switch (key) {
 | 
				
			||||||
	case 0: // A - Stop gauche
 | 
						case 0: // A - Stop gauche
 | 
				
			||||||
		m_keyA = false;
 | 
							m_keyA = false;
 | 
				
			||||||
@@ -1651,265 +1604,12 @@ void Engine::KeyReleaseEvent(unsigned char key) {
 | 
				
			|||||||
	case 28: // 2
 | 
						case 28: // 2
 | 
				
			||||||
		m_key2 = true;
 | 
							m_key2 = true;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case 38: // Shift
 | 
					 | 
				
			||||||
		m_keyShift = false;
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 57: // Espace - Stop sauter
 | 
						case 57: // Espace - Stop sauter
 | 
				
			||||||
		m_keySpace = false;
 | 
							m_keySpace = false;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case 58: // Enter - comfirm input
 | 
					 | 
				
			||||||
		m_keyEnter = false;
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 59: // backspace - remove char
 | 
					 | 
				
			||||||
		m_keyBackspace = false;
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
char Engine::SimulateKeyboard(unsigned char key) {
 | 
					 | 
				
			||||||
	switch (key) {
 | 
					 | 
				
			||||||
	case 0: // A
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'a'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'A'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 1: // B
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'b'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'B'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 2: // C
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'c'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'C'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 3: // D
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'd'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'D'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 4: // E
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'e'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'E'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 5: // F
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'f'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'F'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 6: // G
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'g'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'G'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 7: // H
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'h'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'H'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 8: // I
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'i'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'I'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 9: // J
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'j'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'J'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 10: // K
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'k'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'K'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 11: // L
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'l'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'L'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 12: // M
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'm'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'M'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 13: // N
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'n'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'N'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 14: // O
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'o'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'O'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 15: // P
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'p'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'P'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 16: // Q
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'q'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'Q'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 17: // R
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'r'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'R'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 18: // S
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 's'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'S'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 19: // T
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 't'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'T'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 20: // U
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'u'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'U'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 21: // V
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'v'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'V'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 22: // W
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'w'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'W'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 23: // X
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'x'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'X'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 24: // Y
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'y'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'Y'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 25: // Z
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = 'z'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = 'Z'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 26: // 0
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = '0'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = ')'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 27: // 1
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = '1'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = '!'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 28: // 2
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = '2'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = '\"'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 29: // 3
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = '3'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = '/'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 30: // 4
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = '4'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = '$'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 31: // 5
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = '5'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = '%'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 32: // 6
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = '6'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = '?'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 33: // 7
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = '7'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = '&'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 34: // 8
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = '8'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = '*'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 35: // 9
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = '9'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = ')'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 38: // SHIFT
 | 
					 | 
				
			||||||
		m_keyShift = true;
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 50: // . (Period)
 | 
					 | 
				
			||||||
		m_inputChar = '.';
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 56: // _ (Underscore)
 | 
					 | 
				
			||||||
		if (!m_keyShift) { m_inputChar = '-'; }
 | 
					 | 
				
			||||||
		else { m_inputChar = '_'; }
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 57: // SPACE
 | 
					 | 
				
			||||||
		m_inputChar = ' ';
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 58: // ENTER
 | 
					 | 
				
			||||||
		m_keyEnter = true;
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	case 59: // BACKSPACE
 | 
					 | 
				
			||||||
		m_keyBackspace = true;
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	default:
 | 
					 | 
				
			||||||
		m_invalidChar = true;
 | 
					 | 
				
			||||||
		break;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if ((int)key != 38 && !m_invalidChar) {
 | 
					 | 
				
			||||||
		m_charChanged = true;
 | 
					 | 
				
			||||||
		std::cout << "Key pressed: " << (int)key << " (" << m_inputChar << ")" << std::endl;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	m_invalidChar = false;
 | 
					 | 
				
			||||||
	return m_inputChar;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void Engine::HandlePlayerInput(float elapsedTime) {
 | 
					 | 
				
			||||||
	static float lobbyTime = 0.0f;
 | 
					 | 
				
			||||||
	lobbyTime += elapsedTime;
 | 
					 | 
				
			||||||
	float onInterval = 0.5f;
 | 
					 | 
				
			||||||
	float offInterval = 1.0f;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	m_textureFont.Bind();
 | 
					 | 
				
			||||||
	std::ostringstream ss;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (m_charChanged) {
 | 
					 | 
				
			||||||
		if (m_keyBackspace) {
 | 
					 | 
				
			||||||
			if (!m_currentInputString.empty()) {
 | 
					 | 
				
			||||||
				m_currentInputString.pop_back();
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			m_keyBackspace = false;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		else if (m_keyEnter) {
 | 
					 | 
				
			||||||
			if (m_settingUsername) {
 | 
					 | 
				
			||||||
				if (!m_currentInputString.empty() &&
 | 
					 | 
				
			||||||
					m_currentInputString.size() > 1 &&
 | 
					 | 
				
			||||||
					m_currentInputString.size() < 26) {
 | 
					 | 
				
			||||||
					m_username = m_currentInputString;
 | 
					 | 
				
			||||||
					m_currentInputString = "";
 | 
					 | 
				
			||||||
					m_settingUsername = false;
 | 
					 | 
				
			||||||
					m_settingServer = true;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			else if (m_settingServer) {
 | 
					 | 
				
			||||||
				if (!m_currentInputString.empty()) {
 | 
					 | 
				
			||||||
					m_serverAddr = m_currentInputString;
 | 
					 | 
				
			||||||
					m_currentInputString = "";
 | 
					 | 
				
			||||||
					m_settingServer = false;
 | 
					 | 
				
			||||||
					m_multiReady = true;
 | 
					 | 
				
			||||||
					m_gamestate = GameState::PLAY;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			m_keyEnter = false;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		else if (m_settingUsername && m_currentInputString.size() < 26) {
 | 
					 | 
				
			||||||
			m_currentInputString += m_inputChar;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		else if (m_settingServer && m_currentInputString.size() < 15) {
 | 
					 | 
				
			||||||
			m_currentInputString += m_inputChar;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ss << m_currentInputString;
 | 
					 | 
				
			||||||
	m_charChanged = false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (lobbyTime < onInterval) {
 | 
					 | 
				
			||||||
		ss << "_";
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else if (lobbyTime > onInterval && lobbyTime < offInterval) {
 | 
					 | 
				
			||||||
		ss << " ";
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else {
 | 
					 | 
				
			||||||
		lobbyTime = 0.0f;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	PrintText(Width() * 0.6f, Height() * 0.4f, ss.str(), 2.0f);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void Engine::MouseMoveEvent(int x, int y) {
 | 
					void Engine::MouseMoveEvent(int x, int y) {
 | 
				
			||||||
	if (m_gamestate == GameState::PLAY) {
 | 
						if (m_gamestate == GameState::PLAY) {
 | 
				
			||||||
		m_player.TurnLeftRight(x - (Width() / 2));
 | 
							m_player.TurnLeftRight(x - (Width() / 2));
 | 
				
			||||||
@@ -1997,8 +1697,7 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		else if (x > leftButton && x < rightButton && y > bottomSecond && y < topSecond) {
 | 
							else if (x > leftButton && x < rightButton && y > bottomSecond && y < topSecond) {
 | 
				
			||||||
			if (m_selectedPlayOptions) {
 | 
								if (m_selectedPlayOptions) {
 | 
				
			||||||
				m_gamestate = GameState::LOBBY;
 | 
									m_gamestate = GameState::PLAY;
 | 
				
			||||||
				m_settingUsername = true;
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else {
 | 
								else {
 | 
				
			||||||
				m_gamestate = GameState::OPTIONS;
 | 
									m_gamestate = GameState::OPTIONS;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,7 +45,6 @@ private:
 | 
				
			|||||||
    int GetFps(float elapsedTime) const;
 | 
					    int GetFps(float elapsedTime) const;
 | 
				
			||||||
    int GetCountdown(float elapsedTime);
 | 
					    int GetCountdown(float elapsedTime);
 | 
				
			||||||
    int GetOptionsChoice();
 | 
					    int GetOptionsChoice();
 | 
				
			||||||
    void StartMultiplayerGame();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool LoadTexture(Texture& texture, const std::string& filename, bool useMipmaps = true, bool stopOnError = true);
 | 
					    bool LoadTexture(Texture& texture, const std::string& filename, bool useMipmaps = true, bool stopOnError = true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -62,16 +61,13 @@ private:
 | 
				
			|||||||
    void DisplayInfo(float elapsedTime, BlockType bloc);
 | 
					    void DisplayInfo(float elapsedTime, BlockType bloc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void DisplaySplashScreen();
 | 
					    void DisplaySplashScreen();
 | 
				
			||||||
 | 
					    void DisplayPauseMenu();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void DisplayMainMenu();
 | 
					    void DisplayMainMenu();
 | 
				
			||||||
    void DrawButtonBackgrounds(float centerX, float centerY, int iterations);
 | 
					    void DrawButtonBackgrounds(float centerX, float centerY, int iterations);
 | 
				
			||||||
    void DrawMainMenuButtons(float centerX, float centerY);
 | 
					    void DrawMainMenuButtons(float centerX, float centerY);
 | 
				
			||||||
    void DrawSingleMultiButtons(float centerX, float centerY);
 | 
					    void DrawSingleMultiButtons(float centerX, float centerY);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void DisplayLobbyMenu(float elapsedTime);
 | 
					 | 
				
			||||||
    void SetPlayerUsername(float elapsedTime);
 | 
					 | 
				
			||||||
    void SetServerAddress(float elapsedTime);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    void DisplayOptionsMenu();
 | 
					    void DisplayOptionsMenu();
 | 
				
			||||||
    void DisplayAudioMenu(float centerX, float centerY);
 | 
					    void DisplayAudioMenu(float centerX, float centerY);
 | 
				
			||||||
    void DisplayGraphicsMenu(float centerX, float centerY);
 | 
					    void DisplayGraphicsMenu(float centerX, float centerY);
 | 
				
			||||||
@@ -80,10 +76,9 @@ private:
 | 
				
			|||||||
    void DisplayBarPercentValue(float centerX, float centerY, float posX, float posY, float minVal, float maxVal, float value);
 | 
					    void DisplayBarPercentValue(float centerX, float centerY, float posX, float posY, float minVal, float maxVal, float value);
 | 
				
			||||||
    void DrawSlider(float centerX, float centerY, float value, float minVal, float maxVal, float bottomSideValue, float topSideValue);
 | 
					    void DrawSlider(float centerX, float centerY, float value, float minVal, float maxVal, float bottomSideValue, float topSideValue);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void PrintText(float x, float y, const std::string& t, float charSizeMultiplier = 1.0f);
 | 
					    void PrintText(float x, float y, const std::string& t, float charSizeMultiplier = 1.0f);
 | 
				
			||||||
    void ProcessNotificationQueue();
 | 
					    void ProcessNotificationQueue();
 | 
				
			||||||
    char SimulateKeyboard(unsigned char key);
 | 
					 | 
				
			||||||
    void HandlePlayerInput(float elapsedTime);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Connector m_conn;
 | 
					    Connector m_conn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -127,7 +122,6 @@ private:
 | 
				
			|||||||
    Texture m_texturePovGun;
 | 
					    Texture m_texturePovGun;
 | 
				
			||||||
    Texture m_textureSkybox;
 | 
					    Texture m_textureSkybox;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Texture m_textureLobbyMenu;
 | 
					 | 
				
			||||||
    Texture m_textureMainMenu;
 | 
					    Texture m_textureMainMenu;
 | 
				
			||||||
    Texture m_textureOptionsMenu;
 | 
					    Texture m_textureOptionsMenu;
 | 
				
			||||||
    Texture m_texturePauseMenu;
 | 
					    Texture m_texturePauseMenu;
 | 
				
			||||||
@@ -137,9 +131,6 @@ private:
 | 
				
			|||||||
    Texture m_textureFhd;
 | 
					    Texture m_textureFhd;
 | 
				
			||||||
    Texture m_textureQhd;
 | 
					    Texture m_textureQhd;
 | 
				
			||||||
    Texture m_textureUhd;
 | 
					    Texture m_textureUhd;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    Texture m_textureLobbyServer;
 | 
					 | 
				
			||||||
    Texture m_textureLobbyIdentify;
 | 
					 | 
				
			||||||
    Texture m_textureCheck;
 | 
					    Texture m_textureCheck;
 | 
				
			||||||
    Texture m_textureChecked;
 | 
					    Texture m_textureChecked;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -206,16 +197,6 @@ private:
 | 
				
			|||||||
    bool m_selectedOptions = false;
 | 
					    bool m_selectedOptions = false;
 | 
				
			||||||
    bool m_selectedQuit = false;
 | 
					    bool m_selectedQuit = false;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    std::string m_currentInputString;
 | 
					 | 
				
			||||||
    std::string m_username;
 | 
					 | 
				
			||||||
    std::string m_serverAddr;
 | 
					 | 
				
			||||||
    char m_inputChar = 0;
 | 
					 | 
				
			||||||
    bool m_invalidChar = false;
 | 
					 | 
				
			||||||
    bool m_charChanged = false;
 | 
					 | 
				
			||||||
    bool m_settingUsername = false;
 | 
					 | 
				
			||||||
    bool m_settingServer = false;
 | 
					 | 
				
			||||||
    bool m_multiReady = false;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    bool m_key1 = false;
 | 
					    bool m_key1 = false;
 | 
				
			||||||
    bool m_key2 = false;
 | 
					    bool m_key2 = false;
 | 
				
			||||||
    bool m_keyK = false;
 | 
					    bool m_keyK = false;
 | 
				
			||||||
@@ -224,10 +205,7 @@ private:
 | 
				
			|||||||
    bool m_keyA = false;
 | 
					    bool m_keyA = false;
 | 
				
			||||||
    bool m_keyS = false;
 | 
					    bool m_keyS = false;
 | 
				
			||||||
    bool m_keyD = false;
 | 
					    bool m_keyD = false;
 | 
				
			||||||
    bool m_keyEnter = false;
 | 
					 | 
				
			||||||
    bool m_keySpace = false;
 | 
					    bool m_keySpace = false;
 | 
				
			||||||
    bool m_keyShift = false;
 | 
					 | 
				
			||||||
    bool m_keyBackspace = false;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool m_mouseL = false;
 | 
					    bool m_mouseL = false;
 | 
				
			||||||
    bool m_mouseR = false;
 | 
					    bool m_mouseR = false;
 | 
				
			||||||
 
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 505 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 17 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 11 KiB  | 
		Reference in New Issue
	
	Block a user