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

Constructor & Destructor Documentation

◆ ClientInterpolationEventData() [1/2]

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

Definition at line 186 of file Event.cpp.

186  :
187  TickNumber(tick), TimeInTick(mspassed)
188 {
189  CalculatePercentage();
190 }
int TickNumber
The current tick to use for interpolation.
Definition: Event.h:108

◆ ClientInterpolationEventData() [2/2]

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

Definition at line 193 of file Event.cpp.

194 {
195 
196  packet >> TickNumber >> TimeInTick;
197 
198  if(!packet)
199  throw InvalidArgument("packet for ClientInterpolationEventData is invalid");
200 
201  CalculatePercentage();
202 }
int TickNumber
The current tick to use for interpolation.
Definition: Event.h:108

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

205 {
206 
207  packet << TickNumber << TimeInTick;
208 }
int TickNumber
The current tick to use for interpolation.
Definition: Event.h:108

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

◆ TickNumber

int Leviathan::ClientInterpolationEventData::TickNumber

The current tick to use for interpolation.

Definition at line 108 of file Event.h.

◆ TimeInTick

int Leviathan::ClientInterpolationEventData::TimeInTick

Time passed since start of tick In milliseconds

Definition at line 112 of file Event.h.


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