v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
60
source/game/StarWorldClientState.hpp
Normal file
60
source/game/StarWorldClientState.hpp
Normal file
|
@ -0,0 +1,60 @@
|
|||
#ifndef STAR_WORLD_CLIENT_STATE_HPP
|
||||
#define STAR_WORLD_CLIENT_STATE_HPP
|
||||
|
||||
#include "StarRect.hpp"
|
||||
#include "StarNetElementSystem.hpp"
|
||||
#include "StarGameTypes.hpp"
|
||||
|
||||
namespace Star {
|
||||
|
||||
STAR_CLASS(WorldClientState);
|
||||
|
||||
// Class to aid in network syncronization of client state such as viewing area
|
||||
// and player entity id.
|
||||
class WorldClientState {
|
||||
public:
|
||||
WorldClientState();
|
||||
|
||||
// Actual area of the client visible screen (rounded to nearest block)
|
||||
RectI window() const;
|
||||
void setWindow(RectI const& window);
|
||||
|
||||
// Shortcut to find the window center of the client.
|
||||
Vec2F windowCenter() const;
|
||||
|
||||
// Entity of the unique main Player for this client
|
||||
EntityId playerId() const;
|
||||
void setPlayer(EntityId playerId);
|
||||
|
||||
// Entities that should contribute to the monitoring regions of the client.
|
||||
List<EntityId> const& clientPresenceEntities() const;
|
||||
void setClientPresenceEntities(List<EntityId> entities);
|
||||
|
||||
// All areas of the server monitored by the client, takes a function to
|
||||
// resolve an entity id to its bound box.
|
||||
List<RectI> monitoringRegions(function<Maybe<RectI>(EntityId)> entityBounds) const;
|
||||
|
||||
ByteArray writeDelta();
|
||||
void readDelta(ByteArray delta);
|
||||
|
||||
void reset();
|
||||
|
||||
private:
|
||||
int m_windowMonitoringBorder;
|
||||
int m_presenceEntityMonitoringBorder;
|
||||
|
||||
NetElementTopGroup m_netGroup;
|
||||
uint64_t m_netVersion;
|
||||
|
||||
NetElementInt m_windowXMin;
|
||||
NetElementInt m_windowYMin;
|
||||
NetElementInt m_windowWidth;
|
||||
NetElementInt m_windowHeight;
|
||||
|
||||
NetElementInt m_playerId;
|
||||
NetElementData<List<EntityId>> m_clientPresenceEntities;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue