Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
SnakeEngine/SnakeEngine.h
- Committer:
- Psy1990
- Date:
- 2020-06-04
- Revision:
- 7:9bd49beccdd1
- Child:
- 8:32825d724856
File content as of revision 7:9bd49beccdd1:
#ifndef SNAKEENGINE_H
#define SNAKEENGINE_H
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "SnakeApple.h"
#include "SnakeTail.h"
class SnakeEngine
{
public:
SnakeEngine();
~SnakeEngine();
void init(int borderW,int borderH,int appleY,int appleX,int snakeX,int snakeY,int score);
void read_input(Gamepad &pad);
void update(Gamepad &pad);
void draw(N5110 &lcd);
private:
void check_wall_collision(Gamepad &pad);
void check_snake_collisions(Gamepad &pad);
void check_score(Gamepad &pad);
void print_score(N5110 &lcd);
int _borderW;
int _borderH;
int _score;
// Poistion of apple
int _appleY;
int _applex;
// Position of the snake
int _snakeX;
int _snakeY;
// Head _head;
// Apple _apple;
Direction _dir;
float _mag;
};
#endif