SpelunkyRemake / Tile.h
Tile.h
Raw
#pragma once
#include <vector>
#include "utils.h"
class Texture;

class Tile
{
public:
	enum class Type { Ground, Wood };
	enum class Direction { UP, DOWN, LEFT, RIGHT };

	Tile(int x, int y, int itemType = -1);
	virtual ~Tile();

	virtual void Draw() const = 0;
	virtual void DrawBorder() const = 0;
	virtual void DrawItem() const;
	void DrawVertices() const;

	virtual void UpdateBorder(Tile* pTiles[], int xTiles, int yTiles) = 0;
	virtual void Init(Tile* pTiles[], int xTiles, int yTiles) = 0;

	std::vector<Point2f> GetVertices() const;
	std::vector<Point2f> GetLedgeVertices() const;

	static const float m_Size;
	static Texture* m_pGoldTextures;

	void SetBorder(Direction dir, bool value);

	int GetX() const;
	int GetY() const;

protected:
	Point2f m_Position;
	std::vector<Point2f> m_Vertices;

	int m_X;
	int m_Y;

	bool m_DrawBorder[4];
	int m_Item;

private:
	static int m_Count;
};