Represents the position and velocity of a Shape on an infinite x-y grid.
More...
#include <fish.h>
|
| Fish (Shape shape, int col, int row, int horizontal_speed, int vertical_speed) |
|
int | col () const |
|
int | row () const |
|
int | width () const |
|
int | height () const |
|
void | tick () |
| Update col using horizontal_speed. Update row using vertical_speed. More...
|
|
void | draw (Screen *screen) const |
| Render to the given Screen. Draws over whatever is already there with no concept of transparency. More...
|
|
Represents the position and velocity of a Shape on an infinite x-y grid.
Definition at line 9 of file fish.h.
◆ Fish()
Fish::Fish |
( |
Shape |
shape, |
|
|
int |
col, |
|
|
int |
row, |
|
|
int |
horizontal_speed, |
|
|
int |
vertical_speed |
|
) |
| |
|
explicit |
Construct a Fish at a given position and with the given velocity.
- Parameters
-
shape | the fish drawing |
col | can be positive or negative |
row | can be positive or negative |
horizontal_speed | can be positive or negative |
vertical_speed | can be positive or negative |
Definition at line 9 of file fish.cpp.
◆ col()
- Returns
- column (x-coordinate) of the top left character
Definition at line 15 of file fish.cpp.
◆ draw()
void Fish::draw |
( |
Screen * |
screen | ) |
const |
Render to the given Screen. Draws over whatever is already there with no concept of transparency.
Because Fish::col and Fish::row return unwrapped coordinates, Fish::draw wraps them to the dimensions of the Screen.
Definition at line 38 of file fish.cpp.
◆ height()
int Fish::height |
( |
| ) |
const |
- Returns
- height of the grid of characters
Definition at line 21 of file fish.cpp.
◆ row()
- Returns
- row (y-coordinate) of the top left character
Definition at line 17 of file fish.cpp.
◆ tick()
Update col using horizontal_speed. Update row using vertical_speed.
Definition at line 23 of file fish.cpp.
◆ width()
int Fish::width |
( |
| ) |
const |
- Returns
- width of the grid of characters
Definition at line 19 of file fish.cpp.
The documentation for this class was generated from the following files: