Add Tilemap functionality with creation, updating, and rendering capabilities; implement data retrieval for individual tiles, enhancing graphics management in the application.
This commit is contained in:
34
src/app/gfx/tilemap.h
Normal file
34
src/app/gfx/tilemap.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef YAZE_GFX_TILEMAP_H
|
||||
#define YAZE_GFX_TILEMAP_H
|
||||
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace gfx {
|
||||
|
||||
struct Pair {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
struct Tilemap {
|
||||
Bitmap atlas;
|
||||
absl::flat_hash_map<int, Bitmap> tile_bitmaps;
|
||||
Pair tile_size;
|
||||
Pair map_size;
|
||||
};
|
||||
|
||||
Tilemap CreateTilemap(std::vector<uint8_t> &data, int width, int height,
|
||||
int tile_size, int num_tiles, SnesPalette &palette);
|
||||
|
||||
void UpdateTilemap(Tilemap &tilemap, const std::vector<uint8_t> &data);
|
||||
|
||||
void RenderTile(Tilemap &tilemap, int tile_id);
|
||||
|
||||
std::vector<uint8_t> GetTilemapData(Tilemap &tilemap, int tile_id);
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_GFX_TILEMAP_H
|
||||
Reference in New Issue
Block a user