-
Notifications
You must be signed in to change notification settings - Fork 0
/
Section.hpp
58 lines (47 loc) · 1.13 KB
/
Section.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* Snake game program using the SDL library
*
* @author J. Alvarez
*/
#include "Collideable.hpp"
#include "Screen.hpp"
#include "SDL2/SDL.h"
#ifndef SECTION_HPP
#define SECTION_HPP
namespace SnakeGame {
/**
* This structure represents a section of the snake
* Its (x,y) position corresponds to the top left pixel
*/
struct Section: Collideable {
static const unsigned int S_SECTION_WIDTH;
/**
* Default constructor for creating Section instances
*/
Section();
/**
* @see Collideable#Collideable(int, int)
*/
Section(int x, int y);
/**
* @see Drawable#draw
*/
void draw(Screen & screen);
/**
* Moves the section to another position according to a direction
* @param direction The direction to move this section to
*/
void move(int direction);
/**
* Returns the direction value from this Section to another
* @other The other section to calculate direction
* @return integer indicating direction from Snake::Direction
*/
int calculateDirection(Section & other);
/**
* Show information about this instance on screen
*/
void toString(); // TODO Remove
};
} // namespace SnakeGame
#endif // SECTION_HPP