Mario editor: started refactoring

This commit is contained in:
2021-05-09 00:43:53 +02:00
parent 7b4c3c9697
commit b54ba5034c
8 changed files with 353 additions and 227 deletions
+16 -2
View File
@@ -4,8 +4,22 @@
#include "../sdlpp/sdlpp_scene.hpp"
#include "../sdlpp/sdlpp_rectrenderer.hpp"
struct MapObject {
enum Index {
TERRAIN_TYPE = 0,
TERRAIN_ID = 1,
CHARACTER_TYPE = 2,
CHARACTER_ID = 3,
MODIFIER_TYPE = 4,
MODIFIER_DATA = 5,
};
};
typedef std::tuple<uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t> mapObjectType;
typedef std::array<mapObjectType,16> mapColumnType;
void loadMap(std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::RectangleRender> mario, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer);
void loadMap(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer, std::vector<std::array<std::tuple<uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t>,16>> &objects);
void saveMap(const std::string &file, std::vector<std::array<std::tuple<uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t>,16>> &objects);
void loadMap(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer, std::vector<mapColumnType> &objects);
void saveMap(const std::string &file, std::vector<mapColumnType> &objects);
#endif