made a lot of changes, to get the render pipeline working
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <unordered_map>
|
||||
#include "elements/BehaviourScript.hpp"
|
||||
#include "Vector2.hpp"
|
||||
#include "Vector2i.hpp"
|
||||
#include "elements/Sprite.hpp"
|
||||
#include "elements/TileSet.hpp"
|
||||
|
||||
@@ -21,19 +22,23 @@ namespace TSE
|
||||
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, int> sprites;
|
||||
std::unordered_map<Vector2, Vector2i> sprites;
|
||||
public:
|
||||
Vector2 nextLine;
|
||||
Vector2 pos;
|
||||
TileMapChunk(int _chunksize = 16, const Vector2& _pos = {0,0}, SortingOrder _order = TopRight);
|
||||
|
||||
void SetTile(const Vector2& p, const Vector2& Spriteindex, TileSet* set);
|
||||
void SetTile(const Vector2& p, const Vector2& Spriteindex, const Vector2& Normalindex, TileSet* set);
|
||||
void RemoveTile(Vector2 p);
|
||||
void SetOrdering(SortingOrder _order);
|
||||
void GetOrderedPositions(Vector2* array);
|
||||
void GetOrderedSpriteIds(int* array);
|
||||
const std::vector<Vector2>* GetOrderedPositions();
|
||||
const std::vector<Vector2i>* GetOrderedSpriteIds();
|
||||
int GetChunksize();
|
||||
int GetSpriteCount();
|
||||
|
||||
@@ -42,6 +47,8 @@ namespace TSE
|
||||
class TileMap : public BehaviourScript
|
||||
{
|
||||
private:
|
||||
bool dirty = true;
|
||||
std::vector<Vector2> orderedChunks;
|
||||
Rect bounds = Rect(0,0,0,0);
|
||||
Vector2 nextLine = Vector2(-0.5f, 1.25f);
|
||||
public:
|
||||
@@ -52,9 +59,9 @@ namespace TSE
|
||||
std::unordered_map<Vector2, TileMapChunk> chunks;
|
||||
|
||||
void RemoveTile(Vector2 p);
|
||||
void SetTile(Vector2 p, Vector2 Spriteindex);
|
||||
void SetTile(Vector2 p, Vector2 Spriteindex, Vector2 Normalindex = {-1,-1});
|
||||
TileMapChunk* GetChunk(const Vector2& pos);
|
||||
void GetChunkPositionsInOrder(Vector2* arr);
|
||||
const std::vector<Vector2>* GetChunkPositionsInOrder();
|
||||
int GetChunkCount();
|
||||
TileSet* GetTileSet();
|
||||
const Rect& GetBounds() const { return bounds; }
|
||||
|
||||
Reference in New Issue
Block a user