removed shared_ptr arrays as clang isn't a fan

This commit is contained in:
Noel Berry 2021-01-04 18:38:12 -08:00
parent f8254013c3
commit 68bb409f98
5 changed files with 5 additions and 10 deletions

@ -1 +1 @@
Subproject commit 63466dc2ea6c2affbdd84a696f592796b98d0b3d Subproject commit a1267c738c1d046b3f7872508b511c820af37fae

View File

@ -23,10 +23,7 @@ Collider Collider::make_grid(int tile_size, int columns, int rows)
collider.m_grid.tile_size = tile_size; collider.m_grid.tile_size = tile_size;
collider.m_grid.columns = columns; collider.m_grid.columns = columns;
collider.m_grid.rows = rows; collider.m_grid.rows = rows;
collider.m_grid.cells = std::shared_ptr<bool[]>(new bool[columns * rows]); collider.m_grid.cells.expand(columns * rows);
memset(collider.m_grid.cells.get(), 0, sizeof(bool) * columns * rows);
return collider; return collider;
} }

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
#include <blah.h> #include <blah.h>
#include <memory>
#include "../world.h" #include "../world.h"
using namespace Blah; using namespace Blah;
@ -44,7 +43,7 @@ namespace TL
int columns; int columns;
int rows; int rows;
int tile_size; int tile_size;
std::shared_ptr<bool[]> cells; Vector<bool> cells;
}; };
Shape m_shape = Shape::None; Shape m_shape = Shape::None;

View File

@ -12,7 +12,7 @@ Tilemap::Tilemap(int tile_width, int tile_height, int columns, int rows)
m_tile_height = tile_height; m_tile_height = tile_height;
m_columns = columns; m_columns = columns;
m_rows = rows; m_rows = rows;
m_grid = std::shared_ptr<Subtexture[]>(new Subtexture[columns * rows]); m_grid.expand(columns * rows);
} }
int Tilemap::tile_width() const int Tilemap::tile_width() const

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "../world.h" #include "../world.h"
#include <blah.h> #include <blah.h>
#include <memory>
using namespace Blah; using namespace Blah;
@ -23,7 +22,7 @@ namespace TL
void render(Batch& batch) override; void render(Batch& batch) override;
private: private:
std::shared_ptr<Subtexture[]> m_grid; Vector<Subtexture> m_grid;
int m_tile_width = 0; int m_tile_width = 0;
int m_tile_height = 0; int m_tile_height = 0;
int m_columns = 0; int m_columns = 0;