Rev 240 | Rev 276 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#ifndef SNAKE_H
#define SNAKE_H
#include "CUBE.h"
#define SNAKE_BODY_COLOR BLUE
#define SNAKE_HEAD_COLOR RED
#define SNAKE_CANDY_COLOR GREEN
#define SNAKE_COLLISION_COLOR ORANGE
#define SNAKE_LEVEL_STEP 10
typedef struct {
unsigned x :8;
unsigned y :8;
unsigned z :8;
unsigned :8;
} SNAKE_POINT;
typedef union {
struct {
unsigned up :1;
unsigned down :1;
unsigned left :1;
unsigned backward :1;
unsigned right :1;
unsigned forward :1;
unsigned :2;
};
uint8_t value;
} SNAKE_DIRECTION;
typedef struct {
SNAKE_POINT body[CUBE_PIXELS];
SNAKE_POINT direction;
SNAKE_POINT candy_loc;
uint8_t last_direction;
uint32_t pos_head;
uint32_t pos_tail;
uint32_t length;
uint32_t level;
uint32_t delay;
} SNAKE_DATA;
void Snake_Init(SNAKE_DATA *data);
void Snake_Main(void);
void Snake_Update_Direction(uint8_t p1, uint8_t p2);
void Snake_Update_Frame(void);
SNAKE_POINT Snake_Generate_Candy(void);
#endif /* SNAKE_H */