11 : shape_(shape), col_(col), row_(row), horizontal_speed_(horizontal_speed),
12 vertical_speed_(vertical_speed) {
25 col_ += horizontal_speed_;
26 row_ += vertical_speed_;
29 static int wrap(
int value,
int max) {
31 int clamped = value % max;
34 return clamped >= 0 ? clamped : clamped + max;
Fish(Shape shape, int col, int row, int horizontal_speed, int vertical_speed)
void draw(Screen *screen) const
Render to the given Screen. Draws over whatever is already there with no concept of transparency.
void tick()
Update col using horizontal_speed. Update row using vertical_speed.
Represents the abstract notion of a character-addressable writable screen.
virtual void charAtPut(int col, int row, char value)=0
Represents an ASCII-art drawing and its corresponding bounding box.
char charAt(int col, int row) const
Fetch the character at the given coordinate pair.