LibNRG  0.0.1
Networking for Real-time Games library
 All Classes Files Functions Variables Friends
nrg::State Struct Referenceabstract

Abstract class that represents a protocol followed by the Server and Client.

#include <nrg_state.h>

Inheritance diagram for nrg::State:
nrg::ClientGameState nrg::ClientHandshakeState nrg::ServerHandshakeState nrg::ServerPlayerGameState

Public Member Functions

virtual bool init (Client *c, Server *s, Player *p)=0
 Called to (re)initialise this State instance, for Client-side c won't be null, but s and p will, opposite is true for Server-side.
 
virtual bool onRecvPacket (Packet &p, PacketFlags f)=0
 Called when a Packet is recieved and this is the active State, f shows if the packet was out-of-order or not.
 
virtual bool needsUpdate () const =0
 Called to see if the State would like to be updated.
 
virtual size_t getTimeoutSeconds () const
 Returns a time that the state can go without needsUpdate() returning true, after which update() will be called with f set to STATE_TIMED_OUT.
 
virtual StateResult update (StateConnectionOut &out, StateFlags f=SFLAG_NONE)=0
 Called to update the state (or on a timeout) allowing it to optionally send some Packets using out.
 
virtual ~State ()
 Default destructor.
 

The documentation for this struct was generated from the following file: