Leviathan  0.8.0.0
Leviathan game engine
Leviathan::ClientInterpolationEventData Class Reference

Data for EVENT_TYPE_CLIENT_INTERPOLATION. More...

#include <Event.h>

+ Inheritance diagram for Leviathan::ClientInterpolationEventData:

Public Member Functions

DLLEXPORT ClientInterpolationEventData (int tick, int mspassed)
 
DLLEXPORT ClientInterpolationEventData (sf::Packet &packet)
 
DLLEXPORT void AddDataToPacket (sf::Packet &packet) override
 Adds this to a packet for retrieving it later. More...
 
- Public Member Functions inherited from Leviathan::BaseEventData
virtual ~BaseEventData ()
 

Public Attributes

int TickNumber
 The current tick to use for interpolation. More...
 
int TimeInTick
 
float Percentage
 

Detailed Description

Data for EVENT_TYPE_CLIENT_INTERPOLATION.

Definition at line 69 of file Event.h.

Constructor & Destructor Documentation

◆ ClientInterpolationEventData() [1/2]

DLLEXPORT ClientInterpolationEventData::ClientInterpolationEventData ( int  tick,
int  mspassed 
)

Definition at line 194 of file Event.cpp.

194  :
195  TickNumber(tick), TimeInTick(mspassed)
196 {
197  CalculatePercentage();
198 }
int TickNumber
The current tick to use for interpolation.
Definition: Event.h:82

◆ ClientInterpolationEventData() [2/2]

DLLEXPORT ClientInterpolationEventData::ClientInterpolationEventData ( sf::Packet &  packet)

Definition at line 200 of file Event.cpp.

201 {
202 
203  packet >> TickNumber >> TimeInTick;
204 
205  if(!packet)
206  throw InvalidArgument("packet for ClientInterpolationEventData is invalid");
207 
208  CalculatePercentage();
209 }
int TickNumber
The current tick to use for interpolation.
Definition: Event.h:82

Member Function Documentation

◆ AddDataToPacket()

DLLEXPORT void ClientInterpolationEventData::AddDataToPacket ( sf::Packet &  packet)
overridevirtual

Adds this to a packet for retrieving it later.

Implements Leviathan::BaseEventData.

Definition at line 211 of file Event.cpp.

212 {
213 
214  packet << TickNumber << TimeInTick;
215 }
int TickNumber
The current tick to use for interpolation.
Definition: Event.h:82

Member Data Documentation

◆ Percentage

float Leviathan::ClientInterpolationEventData::Percentage

The calculated percentage the tick has advanced

In case of extreme lag this is forced to be between 0.f-1.f to not break even more badly

Definition at line 92 of file Event.h.

◆ TickNumber

int Leviathan::ClientInterpolationEventData::TickNumber

The current tick to use for interpolation.

Definition at line 82 of file Event.h.

◆ TimeInTick

int Leviathan::ClientInterpolationEventData::TimeInTick

Time passed since start of tick In milliseconds

Definition at line 86 of file Event.h.


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