Balda

Level.h

May 22nd, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. #ifndef LEVEL_H
  2. #define LEVEL_H
  3.  
  4. #pragma comment(lib,"sfml-graphics.lib")
  5. #pragma comment(lib,"sfml-window.lib")
  6. #pragma comment(lib,"sfml-system.lib")
  7.  
  8. #include <string>
  9. #include <vector>
  10. #include <map>
  11. #include <SFML/Graphics.hpp>
  12.  
  13. using namespace std;
  14. using namespace sf;
  15.  
  16. struct Object
  17. {
  18.     int GetPropertyInt(string name);
  19.     float GetPropertyFloat(string name);
  20.     string GetPropertyString(string name);
  21.     string name;
  22.     string type;
  23.     Rect<int> rect;
  24.     map<string, string> properties;
  25.     Sprite sprite;
  26. };
  27.  
  28. struct Layer
  29. {
  30.     int opacity;
  31.     vector<Sprite> tiles;
  32. };
  33.  
  34. class Level
  35. {
  36. public:
  37.     bool LoadFromFile(string filename);
  38.     Object GetObject(string name);
  39.     vector<Object> GetObjects(string name);
  40.     void Draw(RenderWindow &window);
  41.     Vector2i GetTileSize();
  42.  
  43. private:
  44.     int width, height, tileWidth, tileHeight;
  45.     int firstTileID;
  46.     Rect<float> drawingBounds;
  47.     Texture tilesetImage;
  48.     vector<Object> objects;
  49.     vector<Layer> layers;
  50. };
  51.  
  52. #endif
Add Comment
Please, Sign In to add comment