#pragma once #include "Entity.h" #include class Waterline : public Entity { private: static constexpr int WATERLINE_Y = 5; static constexpr char WATERLINE_COLOR = 'c'; static constexpr size_t NUM_WAVE_LAYERS = 4; // Use arrays instead of vectors for fixed-size data std::array shape; std::array colorLines; // Pre-compute shift operations void shiftStringLeft(std::string &str); void shiftStringRight(std::string &str); public: Waterline(); void update() noexcept override; const std::vector &getImage() const override; const std::vector &getMask() const override; char getDefaultColor() const noexcept override { return WATERLINE_COLOR; } bool shouldBeRemoved() const noexcept override { return false; } std::unique_ptr createReplacement() const override { return nullptr; } int getPreferredLayer() const noexcept override { return 0; } private: // Cache vectors to avoid allocation each frame mutable std::vector cached_image; mutable std::vector cached_mask; };