game/mario/maploader.hpp

34 lines
1.0 KiB
C++
Raw Normal View History

2021-04-25 20:42:55 +00:00
#ifndef MAPLOADER_H
#define MAPLOADER_H
#include "../sdlpp/sdlpp_scene.hpp"
#include "../sdlpp/sdlpp_rectrenderer.hpp"
2021-05-08 22:43:53 +00:00
struct MapObject {
enum Index {
TERRAIN_TYPE = 0,
TERRAIN_ID = 1,
CHARACTER_TYPE = 2,
CHARACTER_ID = 3,
MODIFIER_TYPE = 4,
MODIFIER_DATA = 5,
};
};
2021-05-08 22:46:10 +00:00
typedef std::tuple< uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t >
mapObjectType;
typedef std::array< mapObjectType, 16 > mapColumnType;
2021-05-08 22:43:53 +00:00
2021-05-08 22:46:10 +00:00
void loadMap( std::shared_ptr< SDLPP::Scene > &scene,
std::shared_ptr< SDLPP::RenderObject > mario,
2021-05-08 22:46:10 +00:00
const std::string &file,
std::shared_ptr< SDLPP::Renderer > &renderer );
void loadMap( std::shared_ptr< SDLPP::Scene > &scene,
std::shared_ptr< SDLPP::RenderObject > &mario,
const std::string &file,
2021-05-08 22:46:10 +00:00
std::shared_ptr< SDLPP::Renderer > &renderer,
std::vector< mapColumnType > &objects, bool editor = true );
2021-05-08 22:46:10 +00:00
void saveMap( const std::string &file, std::vector< mapColumnType > &objects );
2021-04-25 20:42:55 +00:00
#endif