You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.3 KiB
C
51 lines
1.3 KiB
C
|
4 years ago
|
/******************************************************************************
|
||
|
|
* File - tile_set.h
|
||
|
|
* Author - Joey Pollack
|
||
|
|
* Date - 2022/02/16 (y/m/d)
|
||
|
|
* Mod Date - 2022/02/16 (y/m/d)
|
||
|
|
* Description - Manage a tile set for map making
|
||
|
|
******************************************************************************/
|
||
|
|
|
||
|
|
#ifndef TILE_SET_H_
|
||
|
|
#define TILE_SET_H_
|
||
|
|
|
||
|
4 years ago
|
#include "editor_asset.h"
|
||
|
4 years ago
|
#include <core/types.h>
|
||
|
4 years ago
|
#include <filesystem>
|
||
|
4 years ago
|
|
||
|
|
namespace lunarium { class Image; class IGraphics; }
|
||
|
|
|
||
|
|
namespace lunarium { namespace editor
|
||
|
|
{
|
||
|
4 years ago
|
class TileSet : public EditorAsset
|
||
|
4 years ago
|
{
|
||
|
|
public:
|
||
|
|
TileSet();
|
||
|
4 years ago
|
|
||
|
|
// Load the raw asset file from the internal location
|
||
|
|
OpRes LoadRawFile();
|
||
|
|
OpRes LoadFromXML(pugi::xml_node& node);
|
||
|
|
OpRes SaveToXML(pugi::xml_node& node);
|
||
|
4 years ago
|
|
||
|
|
void SetTileSetID(int id);
|
||
|
|
int GetTileSetID() const;
|
||
|
4 years ago
|
|
||
|
4 years ago
|
void SetImage(Image* image);
|
||
|
|
void SetTileSize(Sizei size);
|
||
|
|
|
||
|
|
Image* GetImage();
|
||
|
|
Sizei GetTileSize();
|
||
|
|
Rectangle GetTileRect(Vec2i index);
|
||
|
|
|
||
|
|
void Render(lunarium::IGraphics* g);
|
||
|
|
|
||
|
|
private:
|
||
|
|
Image* mSetImage;
|
||
|
|
Sizei mTileSize; // in pixels, must be a square power of 2
|
||
|
|
Sizei mNumTiles;
|
||
|
4 years ago
|
int mTileSetID;
|
||
|
4 years ago
|
|
||
|
|
};
|
||
|
|
}}
|
||
|
|
|
||
|
|
#endif // TILE_SET_H_
|