5 #include <Eris/Factory.h>
6 #include <Atlas/Objects/ObjectsFwd.h>
7 #include <wfmath/timestamp.h>
10 #include <sigc++/trackable.h>
11 #include <sigc++/signal.h>
12 #include <sigc++/slot.h>
13 #include <sigc++/connection.h>
33 class View :
public sigc::trackable
69 typedef sigc::slot<void, Entity*> EntitySightSlot;
90 sigc::signal<void, Entity*> Appearance;
91 sigc::signal<void, Entity*> Disappearance;
104 void dumpLookQueue();
112 return m_lookQueue.size();
121 void appear(
const std::string& eid,
float stamp);
122 void disappear(
const std::string& eid);
123 void sight(
const Atlas::Objects::Entity::RootEntity& ge);
124 void create(
const Atlas::Objects::Entity::RootEntity& ge);
125 void deleteEntity(
const std::string& eid);
126 void unseen(
const std::string& eid);
128 void setEntityVisible(
Entity* ent,
bool vis);
131 bool isPending(
const std::string& eid)
const;
133 void addToPrediction(
Entity* ent);
134 void removeFromPrediction(
Entity* ent);
149 Entity* initialSight(
const Atlas::Objects::Entity::RootEntity& ge);
152 void getEntityFromServer(
const std::string& eid);
155 void setTopLevelEntity(
Entity* newTopLevel);
157 Entity* createEntity(
const Atlas::Objects::Entity::RootEntity&);
164 void sendLookAt(
const std::string& eid);
170 void issueQueuedLook();
172 void eraseFromLookQueue(
const std::string& eid);
174 typedef std::map<std::string, Entity*> IdEntityMap;
177 IdEntityMap m_contents;
179 WFMath::TimeStamp m_lastUpdateTime;
193 typedef std::map<std::string, SightAction> PendingSightMap;
194 PendingSightMap m_pending;
203 std::deque<std::string> m_lookQueue;
205 unsigned int m_maxPendingCount;
207 typedef sigc::signal<void, Entity*> EntitySightSignal;
209 typedef std::map<std::string, EntitySightSignal> NotifySightMap;
210 NotifySightMap m_notifySights;
212 typedef std::set<Entity*> EntitySet;
218 class FactoryOrdering
221 bool operator()(Factory* a, Factory* b)
const
223 return a->priority() > b->priority();
227 typedef std::multiset<Factory*, FactoryOrdering> FactoryStore;
228 FactoryStore m_factories;
230 std::set<Task*> m_progressingTasks;
235 #endif // of ERIS_VIEW_H
bool isVisible() const
determine if this entity is visible.
Definition: Entity.cpp:785
An entity which is bound to an Eris::View.
Definition: ViewEntity.h:21
Entity is a concrete (instantiable) class representing one game entity.
Definition: Entity.h:58
Entity * getTopLevel() const
return the current top-level entity.
Definition: View.h:52
Factory is used to allow custom entity creation by client libraries.
Definition: Factory.h:15
void update()
once-per-frame update of the View - clients should call this method once per game loop (or similar),...
Definition: View.cpp:90
bool isMoving() const
Test if this entity has a non-zero velocity vector.
Definition: Entity.cpp:206
Definition: IGRouter.h:14
unsigned int lookQueueSize() const
Retrieve the current look queue size, for debugging / statistics purposes.
Definition: View.h:110
sigc::signal< void, Entity * > EntitySeen
emitted whenever the View creates a new Entity instance.
Definition: View.h:79
The player's avatar representation.
Definition: Avatar.h:32
sigc::signal< void > AvatarEntityDeleted
emitted AFTER the avatar entity was deleted due to a SIGHT(DELETE) op is received
Definition: View.h:88
Definition: LogStream.h:56
float getStamp() const
Access the current time-stamp of the entity.
Definition: Entity.h:614
void taskRateChanged(Task *)
Method to register and unregister tasks with with view, so they can have their progress updated autom...
Definition: View.cpp:126
sigc::signal< void, Entity * > InitialSightEntity
Emitted after a new Entity has been created and initialized.
Definition: View.h:102
const std::string & getId() const
Retrieve the unique entity ID.
Definition: Entity.h:604
void entityDeleted(Entity *ent)
this is a hook that Entity's destructor calls to remove itself from the View's content map.
Definition: View.cpp:444
bool isPending(const std::string &eid) const
test if the specified entity ID is pending initial sight on the View
Definition: View.cpp:356
void setVisible(bool vis)
the View calls this to change local entity visibility.
Definition: Entity.cpp:773
sigc::signal< void, Entity * > EntityCreated
emitted when a SIGHT(CREATE) op is received for an entity
Definition: View.h:82
sigc::signal< void > TopLevelEntityChanged
emitted when the TLVE changes
Definition: View.h:94
bool m_recentlyCreated
flag set if this entity was the subject of a sight(create)
Definition: Entity.h:589
Entity * getEntity(const std::string &eid) const
Retrieve an entity in the view by id.
Definition: View.cpp:53
Underlying Atlas connection, providing a send interface, and receive (dispatch) system.
Definition: Connection.h:40
sigc::signal< void, Entity * > EntityDeleted
emitted when a SIGHT(DELETE) op is received for an entity
Definition: View.h:85
View encapsulates the set of entities currently visible to an Avatar, as well as those that have rece...
Definition: View.h:34
void registerFactory(Factory *)
Register an Entity Factory with this view.
Definition: View.cpp:71
sigc::connection notifyWhenEntitySeen(const std::string &eid, const EntitySightSlot &slot)
Conenct up a slot to be fired when an Entity with the specified ID is seen.
Definition: View.cpp:76