/include/snake.hpp |
---|
1,31 → 1,20 |
#ifndef SNAKE_HPP |
#define SNAKE_HPP |
enum Direction |
{ |
up; |
down; |
left; |
right; |
}; |
class Snake |
{ |
public: |
Snake(); |
void nextPoint(Point newPoint); |
// Stuff that should be private |
vector<Point> points; // list of points snake occupies |
// Colour Values |
int R; |
int G; |
int B; |
Direction direction; |
}; |
#endif // SNAKE_HPP |
#ifndef SNAKE_HPP |
#define SNAKE_HPP |
class Snake |
{ |
public: |
Snake(); |
void nextPoint(Point newPoint); |
// Stuff that should be private |
vector<Point> points; // list of points snake occupies |
// Colour Values |
int R; |
int G; |
int B; |
}; |
#endif // SNAKE_HPP |
/src/snake.cpp |
---|
7,14 → 7,9 |
Snake::Snake() |
{ |
R = 255; |
G = 255; |
B = 0; |
direction = up; |
} |
void Snake::nextPoint(Point newPoint) |
{ |
points.insert(points.begin(), newPoint); |
points.pop_back(); |
points.push_back(newPoint); |
} |