13#include "ObjectList.h"
17const int GRID_WIDTH_DEFAULT = 20;
18const int GRID_HEIGHT_DEFAULT = 8;
20typedef std::tuple<int, int> Cell;
int removeObject(Object *p_o)
Remove Object from grid.
int m_num_rows
Number of rows in grid.
Definition: Grid.h:28
std::set< Cell > positionToCells(Object *p_o, Vector where) const
Return list of Cells for given Object at given location.
void shutDown()
Shutdown (delete grid).
void printLog() const
Print grid cell count to logfile.
int m_width
Grid cell width.
Definition: Grid.h:29
int m_height
Grid cell height.
Definition: Grid.h:30
int insertObject(Object *p_o)
Insert Object into grid.
ObjectList m_out_of_bounds
All out of bounds objects.
Definition: Grid.h:26
Cell positionToCell(Vector where) const
Return Cell (x,y) for given location.
int startUp()
Startup (create grid).
int updatePosition(Object *p_o, Vector where)
Move Object from old position, add to new position.
ObjectList getCollisions(Object *p_o, Vector where) const
Return all Objects that collide at given location.
void setDimensions(int new_width, int new_height)
Set dimensions. Deletes and re-creates grid.
std::string toString() const
Return grid as string.
ObjectList ** m_p_grid
The grid.
Definition: Grid.h:25
ObjectList getObjects(Cell cell) const
Get Objects in a given Cell.
int getHeight() const
Get height.
int m_num_cols
Number of columns in grid.
Definition: Grid.h:27
int getWidth() const
Get width.
Definition: ObjectList.h:15
An animation for a sprite.
Definition: Animation.h:15