From 92daf5551f2469d7b6407b7fa0738f61406cfe9e Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Fri, 26 Jan 2024 21:34:13 +0000 Subject: [PATCH] World: Rename wallColor to fillColor As this function will get more generic, make the names more generic. Fix some comments and indentation. --- World.cpp | 6 +++--- World.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/World.cpp b/World.cpp index 1ca062c..dea9d5b 100644 --- a/World.cpp +++ b/World.cpp @@ -205,13 +205,13 @@ float World::castRay(float originX, float originY, float orientation) const } 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(window.getSize().y)*scale; sf::RectangleShape pixelColumn(sf::Vector2f(1,columnHeight)); pixelColumn.setPosition(static_cast(column), (static_cast(window.getSize().y)-columnHeight)/2.0f); - pixelColumn.setFillColor(wallColor); + pixelColumn.setFillColor(fillColor); window.draw(pixelColumn); } @@ -249,7 +249,7 @@ void World::render(sf::RenderWindow& window) const rayAngle -= 360; } float obstacleScale = player.focalLength*2/(castRay(player.x, player.y, rayAngle)*player.sensorSize); - /* 2 Is wall height in meters. */ + /* 2 Is wall height in meters. */ fillColumn(window, i, obstacleScale); } } diff --git a/World.h b/World.h index 6ecf4ab..59a14b0 100644 --- a/World.h +++ b/World.h @@ -52,9 +52,9 @@ private: sf::Color ceilingColor; 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 originY Ray Y origin, strictly positive * @param orientation Angle to cast to, in degrees between 0 and 360