Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include <SFML/Graphics.hpp>
  4. #include <SFML/Network.hpp>
  5. #include "Enums.hpp"
  6. #include "Player.hpp"
  7. #include "Bullet.hpp"
  8. #include "Collision.hpp"
  9. #include <iostream>
  10.  
  11. class Multiplayer
  12. {
  13.     public:
  14.         Multiplayer(sf::RenderWindow&, Gamestate&, sf::Vector2f&, bool);
  15.         ~Multiplayer();
  16.  
  17.         void runServer();
  18.         void connectToServer();
  19.         sf::Vector2f normalizeMousePosition();
  20.  
  21.         void start();
  22.         void processEvents();
  23.         void update();
  24.         void draw();
  25.  
  26.     private:
  27.         sf::Vector2f playableArea;
  28.  
  29.         sf::RenderWindow *mainWindow;
  30.         sf::RenderTexture *gameTexture;
  31.         sf::View *gameView;
  32.         Gamestate *gamestate;
  33.  
  34.         sf::TcpListener listener;
  35.         sf::TcpSocket socket;
  36.         sf::Packet packetPosition, packetBullet;
  37.  
  38.         sf::Clock gameClock;
  39.         sf::Time gameTime;
  40.  
  41.         Player *player1, *player2;
  42.         std::vector<Bullet> bullets_p1, bullets_p2;
  43.         Collision *collision;
  44.         bool focus;
  45.  
  46.         std::string connectedString, title;
  47.         unsigned bulletsCount;
  48.         const unsigned maxBullets;
  49. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement