Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. class OutputArchive {
  2.     public:
  3.         void operator()(Entity entity);
  4.  
  5.         template<typename T>
  6.         void operator()(Entity entity, const T &value) {
  7.             gkDebug() << entity << (void*)&value;
  8.             (*m_packet) << entity << value;
  9.         }
  10.  
  11.         void setPacket(sf::Packet &packet) { m_packet = &packet; }
  12.  
  13.     private:
  14.         sf::Packet *m_packet = nullptr;
  15. };
  16.  
  17. class InputArchive {
  18.     public:
  19.         void operator()(Entity &entity);
  20.  
  21.         template<typename T>
  22.         void operator()(Entity &, T &value) {
  23.             (*m_packet) >> value;
  24.         }
  25.  
  26.         void setPacket(sf::Packet &packet) { m_packet = &packet; }
  27.  
  28.     private:
  29.         sf::Packet *m_packet = nullptr;
  30. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement