v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
42
source/game/StarDungeonImagePart.hpp
Normal file
42
source/game/StarDungeonImagePart.hpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
#ifndef STAR_DUNGEON_IMAGE_PART_HPP
|
||||
#define STAR_DUNGEON_IMAGE_PART_HPP
|
||||
|
||||
#include "StarDungeonGenerator.hpp"
|
||||
|
||||
namespace Star {
|
||||
|
||||
namespace Dungeon {
|
||||
|
||||
STAR_CLASS(ImagePartReader);
|
||||
STAR_CLASS(ImageTileset);
|
||||
|
||||
class ImagePartReader : public PartReader {
|
||||
public:
|
||||
ImagePartReader(ImageTilesetConstPtr tileset) : m_tileset(tileset) {}
|
||||
|
||||
virtual void readAsset(String const& asset) override;
|
||||
virtual Vec2U size() const override;
|
||||
|
||||
virtual void forEachTile(TileCallback const& callback) const override;
|
||||
virtual void forEachTileAt(Vec2I pos, TileCallback const& callback) const override;
|
||||
|
||||
private:
|
||||
List<pair<String, ImageConstPtr>> m_images;
|
||||
ImageTilesetConstPtr m_tileset;
|
||||
};
|
||||
|
||||
class ImageTileset {
|
||||
public:
|
||||
ImageTileset(Json const& tileset);
|
||||
|
||||
Tile const* getTile(Vec4B color) const;
|
||||
|
||||
private:
|
||||
unsigned colorAsInt(Vec4B color) const;
|
||||
|
||||
Map<unsigned, Tile> m_tiles;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue