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;
87 sigc::signal<void, Entity*> Appearance;
88 sigc::signal<void, Entity*> Disappearance;
101 return m_lookQueue.size();
110 void appear(
const std::string& eid,
float stamp);
111 void disappear(
const std::string& eid);
112 void sight(
const Atlas::Objects::Entity::RootEntity& ge);
113 void create(
const Atlas::Objects::Entity::RootEntity& ge);
114 void deleteEntity(
const std::string& eid);
115 void unseen(
const std::string& eid);
117 void setEntityVisible(
Entity* ent,
bool vis);
120 bool isPending(
const std::string& eid)
const;
122 void addToPrediction(
Entity* ent);
123 void removeFromPrediction(
Entity* ent);
138 Entity* initialSight(
const Atlas::Objects::Entity::RootEntity& ge);
141 void getEntityFromServer(
const std::string& eid);
144 void setTopLevelEntity(
Entity* newTopLevel);
146 Entity* createEntity(
const Atlas::Objects::Entity::RootEntity&);
153 void sendLookAt(
const std::string& eid);
159 void issueQueuedLook();
161 void eraseFromLookQueue(
const std::string& eid);
163 typedef std::map<std::string, Entity*> IdEntityMap;
166 IdEntityMap m_contents;
168 WFMath::TimeStamp m_lastUpdateTime;
170 sigc::signal<void, Entity*> InitialSightEntity;
184 typedef std::map<std::string, SightAction> PendingSightMap;
185 PendingSightMap m_pending;
194 std::deque<std::string> m_lookQueue;
196 unsigned int m_maxPendingCount;
198 typedef sigc::signal<void, Entity*> EntitySightSignal;
200 typedef std::map<std::string, EntitySightSignal> NotifySightMap;
201 NotifySightMap m_notifySights;
203 typedef std::set<Entity*> EntitySet;
209 class FactoryOrdering
212 bool operator()(Factory* a, Factory* b)
const
214 return a->priority() > b->priority();
218 typedef std::multiset<Factory*, FactoryOrdering> FactoryStore;
219 FactoryStore m_factories;
221 std::set<Task*> m_progressingTasks;
226 #endif // of ERIS_VIEW_H
unsigned int lookQueueSize() const
Retrieve the current look queue size, for debugging / statistics purposes.
Definition: View.h:99
void registerFactory(Factory *)
Register an Entity Factory with this view.
Definition: View.cpp:73
Entity * getTopLevel() const
return the current top-level entity.
Definition: View.h:52
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:440
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:78
Factory is used to allow custom entity creation by client libraries.
Definition: Factory.h:14
void update()
once-per-frame update of the View - clients should call this method once per game loop (or similar)...
Definition: View.cpp:92
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:91
View encapsulates the set of entities currently visible to an Avatar, as well as those that have rece...
Definition: View.h:33
Definition: IGRouter.h:13
Entity * getEntity(const std::string &eid) const
Retrieve an entity in the view by id.
Definition: View.cpp:55
void taskRateChanged(Task *)
Method to register and unregister tasks with with view, so they can have their progress updated autom...
Definition: View.cpp:128
sigc::signal< void, Entity * > EntityDeleted
emitted when a SIGHT(DELETE) op is received for an entity
Definition: View.h:85
Definition: Account.cpp:35
Underlying Atlas connection, providing a send interface, and receive (dispatch) system.
Definition: Connection.h:37
An entity which is bound to an Eris::View.
Definition: ViewEntity.h:21
bool isPending(const std::string &eid) const
test if the specified entity ID is pending initial sight on the View
Definition: View.cpp:353
Entity is a concrete (instantiable) class representing one game entity.
Definition: Entity.h:57
The player's avatar representation.
Definition: Avatar.h:31
sigc::signal< void, Entity * > EntitySeen
emitted whenever the View creates a new Entity instance.
Definition: View.h:79