forgot to add the new files
[laserbrain_demo] / src / exman.cc
1 #include "exman.h"
2 #include "exhibit.h"
3 #include "blob_exhibit.h"
4
5 static Exhibit *create_exhibit(const char *type);
6
7 ExhibitManager::ExhibitManager()
8 {
9 }
10
11 ExhibitManager::~ExhibitManager()
12 {
13         int num = (int)items.size();
14         for(int i=0; i<num; i++) {
15                 delete items[i];
16         }
17         items.clear();
18 }
19
20 bool ExhibitManager::load(const MetaScene *mscn, const char *fname)
21 {
22         struct ts_node *root = ts_load(fname);
23         if(!root || strcmp(root->name, "exhibits") != 0) {
24                 ts_free_tree(root);
25                 error_log("failed to load exhibits\n");
26                 return false;
27         }
28
29         ts_free_tree(root);
30         return true;
31 }
32
33
34 static Exhibit *create_exhibit(const char *type)
35 {
36         if(strcmp(type, "static") == 0) {
37                 return new Exhibit;
38         } else if(strcmp(type, "blobs") == 0) {
39                 return new BlobExhibit;
40         }
41         return 0;
42 }