33 lines
568 B
C++
33 lines
568 B
C++
#pragma once
|
|
#include "map.hpp"
|
|
#include <SDL.h>
|
|
#include <map>
|
|
|
|
struct PCollisionRect {
|
|
SDL_Rect rect;
|
|
};
|
|
|
|
struct PCollisionInfo {
|
|
bool isSolid = false;
|
|
};
|
|
|
|
struct PCollisionDatabase {
|
|
std::map<std::string, PCollisionInfo> tileInfo;
|
|
};
|
|
|
|
/*
|
|
* Called once, generates a list of tiles which are solid, and which ones are
|
|
* not solid
|
|
*/
|
|
void PPopulateCollisionDb();
|
|
|
|
/*
|
|
* Check if we can move to the given position in the map
|
|
*/
|
|
bool PCanMoveTo(int x, int y);
|
|
|
|
/*
|
|
* Build a list of PCollisionRects from the given map
|
|
*/
|
|
void PBuildCollisionFromMap(Map *map);
|