0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 07:53:43 +00:00
SDL_Minigame/include/TileComponent.h
freezarite 4ead20ecb7 Cleanup of documentation and refactoring
renamed TextureEnumBase.h to Textures.h
improved some of the doxygen documentation
2024-12-01 14:39:45 +01:00

45 lines
793 B
C++

#pragma once
#include <SDL.h>
#include <string>
#include <map>
#include <magic_enum/magic_enum.hpp>
#include "Component.h"
#include "Textures.h"
class SpriteComponent;
class TransformComponent;
class TileComponent : public Component
{
public:
TransformComponent* transform;
SpriteComponent* sprite;
SDL_Rect tileRect;
int tileID;
Textures texture;
TileComponent() = default;
TileComponent(int x, int y, int w, int h, int id, const std::map<int, std::pair<Textures, bool>>* textureDict);
~TileComponent() = default;
void init() override;
bool hasCollision() {
return this->collision;
}
std::string getName() {
#ifdef TEXTURE_ENUM_DEFINED
return std::string(magic_enum::enum_name(this->texture));
#else
return "Undefined Enum";
#endif
}
private:
bool collision;
};