LPCGame
A Simple 2d Game Engine
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
tilebar.h
1 #ifndef TILEBAR_H
2 #define TILEBAR_H
3 
4 #include <memory>
5 #include "base.h"
6 #include "window.h"
7 #include "image.h"
8 #include "tile.h"
9 #include "entity.h"
10 
12 
16 
17 class TileBar: public Entity {
18 public:
19  TileBar();
20  ~TileBar();
25  void Draw(Camera *cam = nullptr);
27  void OnMouseDown();
32  std::string GetSelection();
43  void Load(Json::Value val);
48  void LoadTileSet(std::shared_ptr<TileSet> ts){ mTileSet = ts; }
53  virtual Json::Value Save() const;
54 private:
55  enum Pane { TILE, OBJECT, ENTITY };
56 
57 private:
58  //predefined variables from the tilebar json entry
59  int tilesPerRow;
60  int spacer;
61  int xOffset;
62  int yOffset;
63  int tileWidth;
64  int tileHeight;
65 
66  //info related to the selected tile
67  Image mSelector;
68  int mSelectedTile;
69  std::string mSelectedTileName;
70 
71  //pointer to the tileset
72  std::shared_ptr<TileSet> mTileSet;
73 };
74 
75 #endif