Subversion Repositories sssnakesss

Compare Revisions

Ignore whitespace Rev 10 → Rev 12

/include/snake.hpp
1,20 → 1,31
#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
#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
/src/snake.cpp
7,9 → 7,14
 
Snake::Snake()
{
R = 255;
G = 255;
B = 0;
direction = up;
}
 
void Snake::nextPoint(Point newPoint)
{
points.push_back(newPoint);
points.insert(points.begin(), newPoint);
points.pop_back();
}