diff --git a/Doodler.h b/Doodler.h index 83d3ab0..917004d 100644 --- a/Doodler.h +++ b/Doodler.h @@ -42,17 +42,17 @@ class Doodler : public IEntity sf::Vector2f m_position = sf::Vector2f(WINDOW_WIDTH / 2, m_floor - m_size.x / 2 - m_outlineThickness); sf::RectangleShape m_shape; - const Lambda m_areCloseAbsolute = [&](float lhs, float rhs) -> bool { + const std::function m_areCloseAbsolute = [&](float lhs, float rhs) -> bool { constexpr float tolerance = 0.001f; return std::abs(lhs - rhs) < tolerance; }; - const Lambda m_areCloseRelative = [&](float lhs, float rhs) -> bool { + const std::function m_areCloseRelative = [&](float lhs, float rhs) -> bool { constexpr float tolerance = 0.001f; return std::abs((lhs - rhs) / rhs) < tolerance; }; - const Lambda m_areFuzzyEqual = [&](float lhs, float rhs) -> bool { + const std::function m_areFuzzyEqual = [&](float lhs, float rhs) -> bool { if (std::abs(rhs) > 1.f) { return m_areCloseRelative(lhs, rhs); @@ -68,7 +68,7 @@ class Doodler : public IEntity void setNextY(); - sf::FloatRect getBounds() const; + sf::FloatRect getBounds() const override; float getNextY() const; }; diff --git a/Engine.h b/Engine.h index 3d222a8..5e584bd 100644 --- a/Engine.h +++ b/Engine.h @@ -15,12 +15,12 @@ class Engine bool m_shouldSetFloor = false; float m_floor = WINDOW_HEIGHT; - const Lambda &)> m_isDoodler = [&]( + const std::function &)> m_isDoodler = [&]( const std::shared_ptr &p_entity) -> bool { return p_entity->getType() == Types::Doodler; }; - const Lambda &)> m_applyForEach = [&]( + const std::function &)> m_applyForEach = [&]( const std::shared_ptr &p_entity) -> void { if (m_p_doodler == nullptr || m_isDoodler(p_entity)) { diff --git a/Platform.h b/Platform.h index 3adf080..ae0afa2 100644 --- a/Platform.h +++ b/Platform.h @@ -29,7 +29,7 @@ class Platform : public IEntity void draw(sf::RenderTarget &target, sf::RenderStates states) const override; - sf::FloatRect getBounds() const; + sf::FloatRect getBounds() const override; }; #endif //DOODLE_JUMP_PLATFORM_H diff --git a/consts.h b/consts.h index da48389..ed00f9a 100644 --- a/consts.h +++ b/consts.h @@ -22,9 +22,6 @@ static const float MOVE_SPEED = 500.f; static const size_t PLATFORM_COUNT = 30; static const unsigned MAX_PRECISION_COUNT = 128; -template -using Lambda = std::function; - enum class Types : size_t { Platform = 0,