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-05
 - Revision:
 - 9:25597bc0cecc
 - Parent:
 - 8:32825d724856
 - Child:
 - 10:3e37b58e8600
 
File content as of revision 9:25597bc0cecc:
#ifndef SNAKEENGINE_H
#define SNAKEENGINE_H
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Apple.h"
#include "Snake.h"
#include "Bitmap.h"
// gap from edge of screen
#define GAP 2
class SnakeEngine
{
public:
    SnakeEngine();
    ~SnakeEngine();
    void init(int apple_size, int snake_speed, int snake_score);
    void read_input(Gamepad &pad); 
    void update(Gamepad &pad);
    void draw(N5110 &lcd);
    
private:
    void print_score(N5110 &lcd);
    
    int sx;
    int sy;
    int ax;
    int ay;
    int _snake_h;
    int _snake_w;
    int _apple_size;
    int _snake_speed;
    int _snake_score;
    
    Snake _s;
    Apple _a;  
    Direction _d;
    float _mag;
};
#endif