ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18zc2

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Touch.h Source File

Touch.h

00001 #ifndef TOUCH_H
00002 #define TOUCH_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include "Bullet.h"
00008 #include "Board.h"
00009 
00010 // gap from edge of screen
00011 #define GAP 2
00012 /** Touch Class
00013 @author Chen Zirui, University of Leeds
00014 @brief Interatcion between board and bullet and all boundaries from top left right and bottom
00015 @date  May 2020
00016 */ 
00017 class Touch
00018 {
00019 
00020 public:
00021     /**initialise board and bullet data*/
00022     void init(int Board_width,int Board_length,int bullet_size,int speed,N5110 &lcd);
00023     /**reading gamepad control*/
00024     void reading(Gamepad &pad);
00025     /**updating*/
00026     void update(Gamepad &pad,N5110 &lcd);
00027     /**drawing*/
00028     void draw(N5110 &lcd);
00029     /**led number*/
00030     int _leds;
00031     
00032 private:
00033     /**Boundary touch judge*/
00034     void Boundary_touch(Gamepad &pad);
00035     /**Board touch judge*/
00036     void Board_touch(Gamepad &pad,N5110 &lcd);
00037     /**drop judge*/
00038     void drop(Gamepad &pad);
00039     /**print score*/
00040     void print_scores(N5110 &lcd);
00041     
00042     Board _board;
00043      
00044     int _Board_width;
00045     int _Board_length;
00046     int _bullet_size;
00047     int _speed;
00048     
00049     // x positions of the Boards
00050     int _board_x;
00051     int _board_y;
00052     int _p1y;
00053     //int _leds;
00054     float X;//[83];
00055     float Y;//[24];
00056     int s;
00057     Bullet _bullet;
00058     
00059     Direction _d;
00060     float _mag;
00061 
00062 };
00063 
00064 #endif