fissh

termios terminal aquarium. demo at ssh://fish@kloet.net
Download | Log | Files | Refs

Whale.h (855B)


      1 #pragma once
      2 #include "../assets/WhaleAssets.h"
      3 #include "Entity.h"
      4 
      5 class Whale : public Entity {
      6 private:
      7   static constexpr float WHALE_SPEED = 1.0f;
      8 
      9   const std::vector<std::vector<std::string>> frames;
     10   const std::vector<std::string> &mask;
     11   const float speed;
     12 
     13   int current_frame_index = 0;
     14   int animation_counter = 0;
     15   mutable std::vector<std::string> current_image;
     16 
     17   static constexpr int ANIMATION_DELAY = 1;
     18   static constexpr int FIRST_FRAME_PAUSE = 10;
     19 
     20   explicit Whale(int asset_index);
     21   static int getRandomDirection();
     22 
     23 public:
     24   Whale();
     25 
     26   void update() noexcept override;
     27   const std::vector<std::string> &getImage() const override;
     28   const std::vector<std::string> &getMask() const override { return mask; }
     29   char getDefaultColor() const noexcept override { return 'B'; }
     30   int getPreferredLayer() const noexcept override;
     31 };