CSCI 3081 - Drone Delivery System
All Classes Files Functions Variables Friends Pages
web_scene_viewer.h
1 #ifndef WEB_SCENE_VIEWER_H_
2 #define WEB_SCENE_VIEWER_H_
3 
4 #include <string>
5 #include <vector>
6 
7 #include "EntityProject/scene_viewer.h"
8 #include "EntityProject/entity_observer.h"
9 
10 namespace entity_project {
11 
13 
17 struct WebSceneViewerState;
18 
21 public:
23  WebSceneViewer(int port, const std::string& webDir, const std::string& scene);
25  virtual ~WebSceneViewer();
26 
28 
31  void SetEntitySystem(IEntitySystem* entitySystem);
33  virtual IEntitySystem* GetEntitySystem() const { return entitySystem_; }
35  bool Run();
37  void OnEvent(const picojson::value& event, const IEntity& entity);
39  void SendJSON(const picojson::value& json);
40 
41 protected:
44 
45 private:
46  WebSceneViewerState* state;
47 };
48 
49 }
50 
51 
52 #endif // ENTITY_H_
IEntitySystem * entitySystem_
The current entity system.
Definition: web_scene_viewer.h:43
void OnEvent(const picojson::value &event, const IEntity &entity)
Sends events to the web page over web sockets.
WebSceneViewer(int port, const std::string &webDir, const std::string &scene)
Constructor that initializes with a port and a website directory.
Abstact class for viewing a scene representing an entity system.
Definition: scene_viewer.h:14
An abstract class that represents an entity system that contains entities and updates over time...
Definition: entity_system.h:10
void SendJSON(const picojson::value &json)
Sends JSON to all web clients.
virtual ~WebSceneViewer()
Destructor.
A web viewer for the entity system that uses web sockets.
Definition: web_scene_viewer.h:20
A movable object in a scene. Entities have position, direction and size.
Definition: entity.h:15
bool Run()
Runs the web viewer.
virtual IEntitySystem * GetEntitySystem() const
Returns the current entity system.
Definition: web_scene_viewer.h:33
Observers entity events when they occur.
Definition: entity_observer.h:14
Definition: entity.h:7
void SetEntitySystem(IEntitySystem *entitySystem)
Sets the current entity system.