game/mario/blocks.hpp

63 lines
2.2 KiB
C++
Raw Normal View History

2021-04-25 20:42:55 +00:00
#ifndef BLOCKS_H
#define BLOCKS_H
#include "../sdlpp/sdlpp_rectrenderer.hpp"
#include <memory>
2021-05-02 12:14:11 +00:00
class MarioBlock : public SDLPP::RectangleRender {
public:
2021-05-08 22:46:10 +00:00
MarioBlock( int x, int y, std::shared_ptr< SDLPP::Renderer > renderer,
2021-05-23 22:07:40 +00:00
std::shared_ptr< SDLPP::Texture > texture, SDL_Rect src, bool destructible = false );
2021-05-02 12:14:11 +00:00
void visit( SDLPP::Visitor &visitor ) override;
2021-05-08 22:46:10 +00:00
void setTool( bool tool = true );
void setTerrain( bool terrain = true );
2021-05-02 12:14:11 +00:00
private:
bool _tool = false;
bool _terrain = true;
2021-05-23 22:07:40 +00:00
bool _destructible = false;
2021-05-02 12:14:11 +00:00
};
2021-05-08 22:46:10 +00:00
extern const std::vector< uint64_t > possibleBlocks;
2021-05-08 22:43:53 +00:00
struct LandType {
2021-05-08 22:46:10 +00:00
enum Value { OVERWORLD = 0, UNDERWORLD = 1, WATER = 2, BOWSER = 4 };
};
2021-05-08 22:43:53 +00:00
struct BlockRole {
enum Value {
TERRAIN,
MODIFIER,
CHARACTER,
MARIO,
};
};
2021-05-08 22:46:10 +00:00
std::shared_ptr< SDLPP::RectangleRender >
createTerrainBlock( uint64_t block_id, LandType::Value type,
std::shared_ptr< SDLPP::Renderer > &renderer,
2021-05-23 22:07:40 +00:00
bool collision = false, bool destructible = false );
2021-05-08 22:46:10 +00:00
std::shared_ptr< SDLPP::RectangleRender >
createTerrainBlock( uint64_t block_id, LandType::Value type,
std::shared_ptr< SDLPP::Renderer > &renderer, int x, int y,
2021-05-23 22:07:40 +00:00
bool collision = false, bool destructible = false );
2021-05-08 22:46:10 +00:00
std::shared_ptr< SDLPP::RectangleRender >
createTerrainBlock( uint64_t block_id, LandType::Value type,
std::shared_ptr< SDLPP::Renderer > &renderer,
std::shared_ptr< SDLPP::Texture > texture,
2021-05-23 22:07:40 +00:00
bool collision = false, bool destructible = false );
2021-05-08 22:46:10 +00:00
std::shared_ptr< SDLPP::RectangleRender >
createTerrainBlock( uint64_t block_id, LandType::Value type,
std::shared_ptr< SDLPP::Renderer > &renderer, int x, int y,
std::shared_ptr< SDLPP::Texture > texture,
2021-05-23 22:07:40 +00:00
bool collision = false, bool destructible = false );
2021-05-08 22:46:10 +00:00
std::shared_ptr< SDLPP::RectangleRender >
createMario( LandType::Value type, std::shared_ptr< SDLPP::Renderer > &renderer,
int x, int y );
2021-05-08 22:43:53 +00:00
SDL_Rect getSourceRectByID( uint64_t id, LandType::Value type );
2021-04-25 20:42:55 +00:00
2021-05-08 22:46:10 +00:00
enum BlockRole::Value getBlockRole( uint64_t id );
2021-05-02 12:28:17 +00:00
2021-04-25 20:42:55 +00:00
#endif