-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnake.h
63 lines (47 loc) · 1.46 KB
/
Snake.h
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
59
60
61
62
63
#ifndef _SNAKE_H
#define _SNAKE_H
#include "textureManager.h"
#include "image.h"
#include "entity.h"
#include "game.h"
class Snake {
public:
// initializer with all of the variables we will need to generate a functioning snake class
Snake();
~Snake();
// void initialize(Graphics* graphics, int x = 0, int y = 0, const char *headTexture = SNAKE_HEAD_TEXTURE, const char *linkTexture = SNAKE_LINK_TEXTURE);
void initialize(Game* game, int x = 0, int y = 0, const char *headTexture = SNAKE_HEAD_TEXTURE, const char *linkTexture = SNAKE_LINK_TEXTURE);
void wipe(); // will be made to reduce the snake to a size of 1 and set its append variable to SNAKE_HEAD_SIZE
void move(); // updates the position of the snake
void append(UINT toAdd);
Direction getMovementDirection();
void setMovementDirection(Direction newDir);
void draw();
Entity **getEntities();
void setDead(bool state);
bool isDead() const;
void onLostDevice();
void onResetDevice();
struct Link: public Entity{
Link();
//Image
//Entity sprite;
int boardX, boardY;
//bool inUse;
};
Link links[SNAKE_MAX_LENGTH];
private:
inline void isInitialized();
void updateLink(Link &input, int newX, int newY);
// Doubly Linked List<Link>
//Graphics* graphics;
TextureManager linkTexture;
TextureManager headTexture;
Direction movementDir;
unsigned int appendNum;
unsigned int linksUsed;
unsigned int defaultX,defaultY;
bool initialized;
bool dead;
};
#endif