1
0
Fork 0

World: Rename wallColor to fillColor

As this function will get more generic, make the names more generic.

Fix some comments and indentation.
This commit is contained in:
Teo-CD 2024-01-26 21:34:13 +00:00
parent a0b6536432
commit 92daf5551f
2 changed files with 5 additions and 5 deletions

View file

@ -205,13 +205,13 @@ float World::castRay(float originX, float originY, float orientation) const
} }
void World::fillColumn(sf::RenderWindow& window, unsigned int column, void World::fillColumn(sf::RenderWindow& window, unsigned int column,
float scale, sf::Color wallColor) const float scale, sf::Color fillColor) const
{ {
float columnHeight = static_cast<float>(window.getSize().y)*scale; float columnHeight = static_cast<float>(window.getSize().y)*scale;
sf::RectangleShape pixelColumn(sf::Vector2f(1,columnHeight)); sf::RectangleShape pixelColumn(sf::Vector2f(1,columnHeight));
pixelColumn.setPosition(static_cast<float>(column), pixelColumn.setPosition(static_cast<float>(column),
(static_cast<float>(window.getSize().y)-columnHeight)/2.0f); (static_cast<float>(window.getSize().y)-columnHeight)/2.0f);
pixelColumn.setFillColor(wallColor); pixelColumn.setFillColor(fillColor);
window.draw(pixelColumn); window.draw(pixelColumn);
} }

View file

@ -52,9 +52,9 @@ private:
sf::Color ceilingColor; sf::Color ceilingColor;
void fillColumn(sf::RenderWindow&, unsigned int column, float scale, void fillColumn(sf::RenderWindow&, unsigned int column, float scale,
sf::Color wallColor = sf::Color(84,56,34)) const; sf::Color fillColor = sf::Color(84,56,34)) const;
/** /**
* Cast a ray from a given position and its distance to the origin. * Cast a ray from a given position and return its distance to the origin.
* @param originX Ray X origin, strictly positive * @param originX Ray X origin, strictly positive
* @param originY Ray Y origin, strictly positive * @param originY Ray Y origin, strictly positive
* @param orientation Angle to cast to, in degrees between 0 and 360 * @param orientation Angle to cast to, in degrees between 0 and 360