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 68 of file Event.h.

Constructor & Destructor Documentation

◆ ClientInterpolationEventData() [1/2]

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

Definition at line 182 of file Event.cpp.

182  :
183  TickNumber(tick), TimeInTick(mspassed)
184 {
185  CalculatePercentage();
186 }
int TickNumber
The current tick to use for interpolation.
Definition: Event.h:81

◆ ClientInterpolationEventData() [2/2]

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

Definition at line 188 of file Event.cpp.

189 {
190 
191  packet >> TickNumber >> TimeInTick;
192 
193  if(!packet)
194  throw InvalidArgument("packet for ClientInterpolationEventData is invalid");
195 
196  CalculatePercentage();
197 }
int TickNumber
The current tick to use for interpolation.
Definition: Event.h:81

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 199 of file Event.cpp.

200 {
201 
202  packet << TickNumber << TimeInTick;
203 }
int TickNumber
The current tick to use for interpolation.
Definition: Event.h:81

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 91 of file Event.h.

◆ TickNumber

int Leviathan::ClientInterpolationEventData::TickNumber

The current tick to use for interpolation.

Definition at line 81 of file Event.h.

◆ TimeInTick

int Leviathan::ClientInterpolationEventData::TimeInTick

Time passed since start of tick In milliseconds

Definition at line 85 of file Event.h.


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