0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 05:43:43 +00:00

add documentation to calculateSpawnPosition

This commit is contained in:
ineslelin 2024-12-17 22:56:58 +01:00
parent 7e088594ae
commit 29743d11b0
2 changed files with 7 additions and 0 deletions

View File

@ -27,6 +27,12 @@ public:
void createProjectile(Vector2D pos, Vector2D velocity, int scale, int range, int speed, const char* texturePath, Entity* owner);
void createPowerup(Vector2D pos, std::function<void (Entity*)> pickupFunc, std::string texturePath);
/*!
* \brief Calculates a random spawn position for an object within a given area
* \param size The size (collision box) of the object
* \param spawnArea The area within which a spawn position will be calculated
* \returns Spawn Coordinates for the object
*/
Vector2D calculateSpawnPosition(Vector2D size, Vector2D spawnArea);
template <typename T> [[deprecated]] T calculateRandomType(int amount);

View File

@ -74,6 +74,7 @@ void AssetManager::createPowerup(Vector2D pos, std::function<void (Entity*)> pic
powerups.addGroup((size_t)Entity::GroupLabel::POWERUPS);
}
Vector2D AssetManager::calculateSpawnPosition(Vector2D size, Vector2D spawnArea)
{
Vector2D spawnPos = Vector2D(-1, -1);