Fishtank
fish.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "screen.h"
4 #include "shape.h"
5 #include <string>
6 #include <vector>
7 
9 class Fish {
10 public:
18  explicit Fish(Shape shape, int col, int row, int horizontal_speed,
19  int vertical_speed);
21  int col() const;
23  int row() const;
25  int width() const;
27  int height() const;
29  void tick();
35  void draw(Screen *screen) const;
36 
37 private:
38  Shape shape_;
39  int col_;
40  int row_;
41  int horizontal_speed_;
42  int vertical_speed_;
43 };
shape.h
Fish::width
int width() const
Definition: fish.cpp:16
screen.h
Screen
Represents the abstract notion of a character-addressable writable screen.
Definition: screen.h:4
Shape
Represents an ASCII-art drawing and its corresponding bounding box.
Definition: shape.h:7
Fish::row
int row() const
Definition: fish.cpp:14
Fish::Fish
Fish(Shape shape, int col, int row, int horizontal_speed, int vertical_speed)
Definition: fish.cpp:7
Fish::draw
void draw(Screen *screen) const
Render to the given Screen. Draws over whatever is already there with no concept of transparency.
Definition: fish.cpp:35
Fish::tick
void tick()
Update col using horizontal_speed. Update row using vertical_speed.
Definition: fish.cpp:20
Fish
Represents the position and velocity of a Shape on an infinite x-y grid.
Definition: fish.h:9
Fish::height
int height() const
Definition: fish.cpp:18
Fish::col
int col() const
Definition: fish.cpp:12