GPR5100 - Rollback
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
game::NetworkClient Class Referencefinal

NetworkClient is a network client that uses SFML sockets. More...

#include <network_client.h>

Inheritance diagram for game::NetworkClient:
Inheritance graph
[legend]
Collaboration diagram for game::NetworkClient:
Collaboration graph
[legend]

Public Types

enum class  State {
  NONE , JOINING , JOINED , GAME_STARTING ,
  GAME
}
 
enum class  PacketSource { TCP , UDP }
 

Public Member Functions

void Begin () override
 
void Update (sf::Time dt) override
 
void End () override
 
void DrawImGui () override
 
void Draw (sf::RenderTarget &renderTarget) override
 
void SendReliablePacket (std::unique_ptr< Packet > packet) override
 
void SendUnreliablePacket (std::unique_ptr< Packet > packet) override
 
void SetPlayerInput (PlayerInput playerInput)
 
void ReceivePacket (const Packet *packet) override
 ReceiveNetPacket is a method called by an app owning a client when receiving a packet. It is the same one for simulated and network client. More...
 
- Public Member Functions inherited from game::Client
virtual void SetWindowSize (sf::Vector2u windowSize)
 
virtual void ReceivePacket (const Packet *packet)
 ReceiveNetPacket is a method called by an app owning a client when receiving a packet. It is the same one for simulated and network client. More...
 
void Update (sf::Time dt) override
 
virtual void Draw (sf::RenderTarget &renderTarget)=0
 
virtual void DrawImGui ()=0
 
virtual void SendReliablePacket (std::unique_ptr< Packet > packet)=0
 
virtual void SendUnreliablePacket (std::unique_ptr< Packet > packet)=0
 
virtual void Begin ()=0
 
virtual void Update (sf::Time dt)=0
 
virtual void End ()=0
 

Additional Inherited Members

- Protected Attributes inherited from game::Client
ClientGameManager gameManager_
 
ClientId clientId_ = INVALID_CLIENT_ID
 
float pingTimer_ = -1.0f
 
float currentPing_ = 0.0f
 
float srtt_ = -1.0f
 
float rttvar_ = 0.0f
 
float rto_ = 1.0f
 
- Static Protected Attributes inherited from game::Client
static constexpr float pingPeriod_ = 0.3f
 
static constexpr float k = 4.0f
 
static constexpr float g = 100.0f
 
static constexpr float alpha = 1.0f/8.0f
 
static constexpr float beta = 1.0f/4.0f
 

Detailed Description

NetworkClient is a network client that uses SFML sockets.

Member Function Documentation

◆ Begin()

void game::NetworkClient::Begin ( )
overridevirtual

Implements core::SystemInterface.

◆ Draw()

void game::NetworkClient::Draw ( sf::RenderTarget &  renderTarget)
overridevirtual

Implements core::DrawInterface.

◆ DrawImGui()

void game::NetworkClient::DrawImGui ( )
overridevirtual

◆ End()

void game::NetworkClient::End ( )
overridevirtual

Implements core::SystemInterface.

◆ ReceivePacket()

void game::NetworkClient::ReceivePacket ( const Packet packet)
overridevirtual

ReceiveNetPacket is a method called by an app owning a client when receiving a packet. It is the same one for simulated and network client.

Parameters
packetA non-owning pointer to a packet (you don't need to care about deleting it

Reimplemented from game::Client.

Here is the call graph for this function:

◆ SendReliablePacket()

void game::NetworkClient::SendReliablePacket ( std::unique_ptr< Packet packet)
overridevirtual

◆ SendUnreliablePacket()

void game::NetworkClient::SendUnreliablePacket ( std::unique_ptr< Packet packet)
overridevirtual

◆ Update()

void game::NetworkClient::Update ( sf::Time  dt)
overridevirtual

Reimplemented from game::Client.


The documentation for this class was generated from the following files: