00001 00008 #ifndef _LEVEL_H 00009 #define _LEVEL_H 00010 00011 #include <ClanLib/core.h> 00012 00013 #include <map> 00014 #include <string> 00015 00016 #include "main.h" 00017 #include "object.h" 00018 #include "actor.h" 00019 #include "goal.h" 00020 #include "worldbox.h" 00021 00022 class Level { 00023 public: 00024 00025 typedef map<int, Object*> ObjectList; 00026 typedef map<int, Actor*> ActorList; 00027 typedef map<int, Goal*> GoalList; 00028 typedef ObjectList::iterator ObjectIterator; 00029 typedef ActorList::iterator ActorIterator; 00030 typedef GoalList::iterator GoalIterator; 00031 00032 Level( string filename ); 00033 00034 ~Level( void ); 00035 00036 Object *new_object_from_dom( const CL_DomElement& element ); 00037 00038 const bool level_completed( void ); 00039 00040 ObjectList& get_objects( void ) { return _objects; } 00041 ActorList& get_actors( void ) { return _actors; } 00042 int get_level_id( void ) const { return _id; } 00043 string get_filename( void ) const { return _filename; } 00044 string get_description( void ) const { return _description; } 00045 Vec3 get_world_size( ) const { return _world_box->get_size(); } 00046 00047 void tick( double t ); 00048 00049 void render( void ); 00050 00051 void stop_sim( void ); 00052 00053 void reset_level( void ); 00054 00055 void save( string filename = "" ); 00056 void save( ostream& out ); 00057 public: 00058 00059 int _id; 00060 00061 string _filename; 00062 00063 string _description; 00064 00065 GoalList _goals; 00066 ObjectList _objects; 00067 ActorList _actors; 00068 00069 WorldBox* _world_box; 00070 00071 double _camera_radius; 00072 double _camera_elevation; 00073 double _camera_azimuth; 00074 }; 00075 00076 #endif // header guard