mirror of
https://github.com/BreizhHardware/bloubloulespoissons.git
synced 2026-01-18 16:47:31 +01:00
refactor: réorganisation du code et des fichiers
- Déplacement des fichiers `networking.cpp`, `networking.h`, `networking_client.h` vers le répertoire `Network` - Mise à jour des inclusions de fichiers pour refléter les nouveaux chemins - Ajout des nouvelles fonctions `handleQuitThread`, `handleQuit`, `cleanup` dans `close.cpp` - Mise à jour de `CMakeLists.txt` pour inclure les nouveaux chemins des fichiers - Mise à jour de `main.cpp` pour inclure les nouveaux chemins des fichiers - Ajout de la gestion des threads pour les poissons, les joueurs et le requin - Ajout de la gestion des événements de menu et de la musique de fond
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
//
|
||||
|
||||
#include "networking.h"
|
||||
|
||||
std::unordered_map<int, std::pair<int, int>> playerPositions;
|
||||
std::unordered_map<int, std::chrono::time_point<std::chrono::steady_clock>> lastKeepAlive;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <chrono>
|
||||
#include "../env.h"
|
||||
#include "../Utility/env.h"
|
||||
#include "networking_client.h"
|
||||
#include "../player.h"
|
||||
#include "../shark.h"
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include "../env.h"
|
||||
#include "../Utility/env.h"
|
||||
#include "../player.h"
|
||||
|
||||
class Player;
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include "env.h"
|
||||
#include "../network/networking.h"
|
||||
#include "../Network/networking.h"
|
||||
|
||||
void cleanup();
|
||||
void handleQuit();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include "player.h"
|
||||
#include "../player.h"
|
||||
|
||||
double calculateDistance(int x1, int y1, int x2, int y2);
|
||||
void displayNearbyPlayers(SDL_Renderer* renderer, TTF_Font* font, Player& currentPlayer, std::vector<Player>& players, double threshold);
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
//
|
||||
|
||||
#include "decors.h"
|
||||
#include <iostream>
|
||||
|
||||
#include "env.h"
|
||||
|
||||
void Rock::draw(SDL_Renderer* renderer) const{
|
||||
Camera& camera = Camera::getInstance();
|
||||
|
||||
2
decors.h
2
decors.h
@@ -9,7 +9,9 @@
|
||||
#include <ctime>
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include "camera.h"
|
||||
#include "Utility/env.h"
|
||||
|
||||
class Rock {
|
||||
public:
|
||||
|
||||
2
fish.h
2
fish.h
@@ -7,7 +7,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "camera.h"
|
||||
#include "env.h"
|
||||
#include "Utility/env.h"
|
||||
|
||||
class Fish {
|
||||
private:
|
||||
|
||||
7
main.cpp
7
main.cpp
@@ -21,11 +21,12 @@
|
||||
#include "Utility/utility.h"
|
||||
#include "player.h"
|
||||
#include "menu.h"
|
||||
#include "network/networking.h"
|
||||
#include "network/networking_client.h"
|
||||
#include "Network/networking.h"
|
||||
#include "Network/networking_client.h"
|
||||
#include "shark.h"
|
||||
#include "Utility/event.h"
|
||||
#include "Utility/close.h"
|
||||
|
||||
#include "event.h"
|
||||
|
||||
|
||||
#include <system_error>
|
||||
|
||||
2
menu.h
2
menu.h
@@ -1,5 +1,5 @@
|
||||
#include <iostream>
|
||||
#include "env.h"
|
||||
#include "Utility/env.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_image.h>
|
||||
#include <SDL2/SDL_ttf.h>
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
#include "player.h"
|
||||
|
||||
#include <syncstream>
|
||||
#include <tuple>
|
||||
#include "network/networking_client.h"
|
||||
#include "camera.h"
|
||||
|
||||
void Player::updatePlayerPos(int x, int y) {
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
|
||||
4
player.h
4
player.h
@@ -6,6 +6,10 @@
|
||||
#include <iostream>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
#include <syncstream>
|
||||
#include <tuple>
|
||||
#include "Network/networking_client.h"
|
||||
#include "camera.h"
|
||||
#include "fish.h"
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#define sharkIMG "../img/shark.png"
|
||||
#include "shark.h"
|
||||
|
||||
#include "network/networking.h"
|
||||
|
||||
Shark::Shark(const int x, const int y, const float vx, const float vy, const int id, const int width, const int height, SDL_Renderer* renderer, std::vector<Player> &players_list)
|
||||
: x(x), y(y), vx(vx), vy(vy), id(id), width(width), height(height), players_list(players_list) {
|
||||
SDL_Surface* sharkSurface = IMG_Load(sharkIMG);
|
||||
|
||||
Reference in New Issue
Block a user