added further fixes, and upgrades

This commit is contained in:
2026-03-01 20:51:39 +01:00
parent 769bbd4261
commit f859288689
16 changed files with 937 additions and 24 deletions

View File

@@ -8,28 +8,21 @@
#include "Vector2i.hpp"
#include "elements/Sprite.hpp"
#include "elements/TileSet.hpp"
#include "enums/SortingOrder.hpp"
namespace TSE
{
enum SortingOrder
{
TopRight,
TopLeft,
BottomRight,
BottomLeft,
};
struct TileMapChunk
{
private:
bool dirtyPositions = true;
bool dirtySpriteIds = true;
std::vector<Vector2> orderedPositions;
std::vector<Vector2i> orderedSpriteIDs;
SortingOrder order;
int chunksize;
std::unordered_map<Vector2, Vector2i> sprites;
public:
bool dirtyPositions = true;
bool dirtySpriteIds = true;
Vector2 nextLine;
Vector2 pos;
TileMapChunk(int _chunksize = 16, const Vector2& _pos = {0,0}, SortingOrder _order = TopRight);
@@ -50,10 +43,10 @@ namespace TSE
bool dirty = true;
std::vector<Vector2> orderedChunks;
Rect bounds = Rect(0,0,0,0);
Vector2 nextLine = Vector2(-0.5f, 1.25f);
Vector2 nextLine = Vector2(0.5f, 0.5f);
public:
int chunkSize = 16;
SortingOrder order = TopRight;
SortingOrder order = BottomRight;
Vector2 SpriteScale = Vector2(1,1);
TileSet* set;
std::unordered_map<Vector2, TileMapChunk> chunks;
@@ -69,6 +62,7 @@ namespace TSE
Vector2 GetNextLineOffset();
Vector2 RealPosToTileMapPos(const Vector2& v);
Vector2 TileMapToRealPos(const Vector2& v);
void DirtyAll();
inline const char* GetName() override
{