Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

GameObjects/Blocks/Blocks.h

Committer:
AhmedPlaymaker
Date:
2019-05-06
Revision:
84:9950d561fdf8
Parent:
83:329da564799a
Child:
95:b068b0735f45

File content as of revision 84:9950d561fdf8:

#ifndef BLOCKS_H
#define BLOCKS_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"


class Blocks
{
    public:
    Blocks();
    ~Blocks();
    /** Initialise Blocks
    *
    *   This function initialises the Blocks library.
    */
    void init(N5110 *lcd);
    
    /** Draw
    *
    *   This function draws the Blocks onto the screen.
    */
    void draw(int length);
    
    /** Draw Frame
    *
    *   This function draws the Blocks' sides onto the screen.
    */
    void DrawFrame();
    
    /** Choose Blocks
    *
    *   This function chooses the correct block using a case structure and draws them onto the screen.
    */
    void ChooseBlocks();
    
    /** Update
    *
    *   This function updates the position of the Blocks as they move down the screen.
    */
    void update(int blocknum, int blockgap, int srn, int send_block_number);
    
    /** Get Position
    *
    *   This function obtains the coordinates of the top-left pixel in the Blocks sprites.
    */
    Vector2D get_pos();
    
    /** Get Number
    *
    *   This function obtains the number inside the Blocks sprite at a specefic location.
    */
    int * get_number();
    
    /** Set Position
    *
    *   This function is used to change the position of the sprite to specific coordinates when called.
    */
    void set_pos(Vector2D p);
    double round; //used to save the rounded number to set the value inside the block.
    int caseselect[5];
    int send;
    Vector2D velocity;
    
    

    private:
    int _length;
    int reset;
    int _bx;  //block x
    int _by;  //block y

    //Pointer to the game pad object pad.
    Gamepad *_pad;
    //Pointer to the N5110 object lcd.
    N5110 *_lcd;

};
#endif