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:
- el18lg
- Date:
- 2020-05-28
- Revision:
- 6:266fb8fc17f4
- Parent:
- 5:e0f08e8022de
- Child:
- 7:24a3f13ce36d
File content as of revision 6:266fb8fc17f4:
#ifndef SNAKEENGINE_H
#define SNAKEENGINE_H
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Head.h"
#include "Body.h"
#include "Food.h"
// gap from edge of screen
#define GAP 2
class SnakeEngine
{
public:
SnakeEngine();
~SnakeEngine();
void init(int head_length,int head_speed);
void read_input(Gamepad &pad);
void update(Gamepad &pad, N5110 &lcd);
void draw(N5110 &lcd);
private:
int hx;
int hy;
int _head_length;
int _head_speed;
int _nbody;
Head _h;
Body _b;
Food _f;
Direction _d;
float _mag;
};
#endif