refactor codebase, add Makefile

This commit is contained in:
2025-03-29 21:40:07 -04:00
parent 0629fe8eb3
commit 1c6f456225
10 changed files with 307 additions and 231 deletions
+38
View File
@@ -0,0 +1,38 @@
#ifndef TILEMAP_H
#define TILEMAP_H
#include <vector>
#include <map>
#include <string>
#include "Tile.h"
using namespace std;
class TileMap {
private:
vector<Tile> tiles;
int layers;
int width, height;
int baseTileCode = 0xE000;
int cellPixelsX = 8;
int cellPixelsY = 4;
vector<map<pair<int, int>, Tile>> tileLayerMap;
public:
TileMap();
bool loadMapJson(const string& filename);
bool getTile(int x, int y, int layer, Tile& returnTile) const;
bool getCollision(int x, int y, int layer) const;
//TODO
bool hasCollisionAt(int x, int y) const;
bool isInBounds(int x, int y) const;
bool canMoveTo(int x, int y) const;
void render(int x, int y, int viewWidth, int viewHeight);
void render(int x, int y, int viewWidth, int viewHeight, int xOffset, int yOffset);
int getWidth() const;
int getHeight() const;
};
#endif