2222222

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers cxkEngine.h Source File

cxkEngine.h

00001 #ifndef cxkEngine_H
00002 #define cxkEngine_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include "Ball.h"
00008 #include "CXK.h"
00009 
00010 
00011 /** cxkEngine Class
00012 * @brief the diagram of the ball and others 
00013 * @author Zhang Xinyu 201090208
00014 * @brief school EE of  SWJTU &leeds joint school
00015 * @date  MAY  2019
00016 */ 
00017 
00018 class cxkEngine
00019 {
00020 
00021 public:
00022 
00023 /** Constructor */
00024     cxkEngine();
00025     
00026     /** Destrctor */
00027     ~cxkEngine();
00028 
00029  /** Set the cxkEngineinit  
00030        * @ param value of the cxk feature of the CXK file (CXK_width, CXK_height)
00031         * @ param value of the ball size of the ballfile (ball_size)
00032          * @ param value of the move speed of the CXKand ball file (speed)
00033     */
00034     void init(int CXK_width,int CXK_height,int ball_size,int speed);
00035     
00036     /** Set the cxkEread_Iinput
00037       * @ details use CXK and BAll to read the value of direction and maganitude of joystick
00038     */
00039     void read_input(Gamepad &pad);
00040     
00041 
00042     /** Set the cxkEupdate 
00043       * @ details updated the d and vara from the read_input
00044     */
00045     void update(Gamepad &pad);
00046     
00047      /** Set the CXKdraw  
00048        * @ param  the score player get (cxkp_score)
00049        * @ details draw the wall and basket to the game
00050        */
00051     void draw(N5110 &lcd);
00052     
00053 private:
00054 
00055     void check_wall_collision(Gamepad &pad);
00056     void check_CXK_collisions(Gamepad &pad);
00057     void check_goal(Gamepad &pad);
00058     void print_scores(N5110 &lcd);
00059     
00060    
00061     CXK _cxkp;
00062      
00063     int _CXK_width;
00064     int _CXK_height;
00065     int _ball_size;
00066     int _speed;
00067     int _direction;
00068     
00069     // xy positions of theCXKs
00070 ///////// 
00071     int _cxkpx;
00072     int _cxkpy;
00073     
00074     Ball _ball;
00075     
00076     Direction _d;
00077     float _vara;
00078 
00079 };
00080 
00081 #endif