moved a bunch around
This commit is contained in:
@@ -73,7 +73,9 @@ public:
|
||||
|
||||
void clear() {
|
||||
Positions.clear();
|
||||
Positions.rehash(0);
|
||||
ƨnoiƚiƨoꟼ.clear();
|
||||
ƨnoiƚiƨoꟼ.rehash(0);
|
||||
next_id = 0;
|
||||
}
|
||||
|
||||
@@ -165,6 +167,7 @@ public:
|
||||
|
||||
void clear() {
|
||||
grid.clear();
|
||||
grid.rehash(0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -767,6 +770,9 @@ public:
|
||||
Sizes.clear();
|
||||
spatialGrid.clear();
|
||||
neighborMap.clear();
|
||||
Colors.rehash(0);
|
||||
Sizes.rehash(0);
|
||||
neighborMap.rehash(0);
|
||||
}
|
||||
|
||||
// neighbor map
|
||||
|
||||
34
util/grid/sprite2.hpp
Normal file
34
util/grid/sprite2.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef SPRITE2_HPP
|
||||
#define SPRITE2_HPP
|
||||
|
||||
#include "grid2.hpp"
|
||||
#include "../output/frame.hpp"
|
||||
|
||||
class SpriteMap2 : public Grid2 {
|
||||
private:
|
||||
|
||||
// id, sprite
|
||||
//std::unordered_map<size_t, std::shared_ptr<Grid2>> Sprites;
|
||||
std::unordered_map<size_t, frame> spritesComped;
|
||||
std::unordered_map<size_t, int> Layers;
|
||||
std::unordered_map<size_t, float> Orientations;
|
||||
|
||||
public:
|
||||
|
||||
using Grid2::Grid2;
|
||||
size_t addSprite(const Vec2& pos, frame sprite, int layer = 0, float orientation = 0.0f) {
|
||||
size_t id = addObject(pos, Vec4(0,0,0,0));
|
||||
spritesComped[id] = sprite;
|
||||
Layers[id] = layer;
|
||||
Orientations[id] = orientation;
|
||||
}
|
||||
|
||||
frame getSprite(size_t id) {
|
||||
return spritesComped.at(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user