zhangxinyu01text
Embed:
(wiki syntax)
Show/hide line numbers
Ball.h
00001 #ifndef BALL_H 00002 #define BALL_H 00003 00004 #include "mbed.h" 00005 #include "N5110.h" 00006 #include "Gamepad.h" 00007 #include "CXK.h" 00008 00009 /** Ball Class 00010 * @brief Controls the ball in Ubeautiful CXK game 00011 * @author Zhang Xinyu 00012 * @school EE of SWJTU &leeds joint school 00013 * @date MAY 2019 00014 */ 00015 00016 class Ball 00017 { 00018 00019 public: 00020 /** Constructor */ 00021 Ball(); 00022 00023 /** Destrctor */ 00024 ~Ball(); 00025 00026 /** Set the ball init 00027 * @param the value of init (size,speed, direction) 00028 */ 00029 void init(int size,int speed, int direction); 00030 00031 00032 /** Set the balldraw 00033 * @ details lcd.drawCircle(_x,_y,_size,FILL_BLACK); 00034 * @ param value that updated (_x,_y, _size) 00035 */ 00036 void draw(N5110 &lcd); 00037 00038 00039 /** Set the update 00040 * @details updated the _x,_y value by speed means move the ball 00041 */ 00042 void update(); 00043 00044 /// accessors and mutators 00045 00046 /** Set the balldraw 00047 * @ details set the value of veocity LCD cooresponding v = {_velocity.x,_velocity.y}; 00048 * @ param value that updated (v) 00049 * @ returns v 00050 */ 00051 void set_velocity(Vector2D v); 00052 Vector2D get_velocity(); 00053 Vector2D get_pos(); 00054 00055 /** Set the balldraw 00056 * @ details set the value of position of LCD cooresponding p= {x,y}; 00057 * @ param value that updated (p) 00058 * @ returns p 00059 */ 00060 void set_pos(Vector2D p); 00061 00062 private: 00063 00064 Vector2D _velocity; 00065 int _size; 00066 int _x; 00067 int _y; 00068 int _direction; 00069 }; 00070 #endif
Generated on Mon Feb 20 2023 02:55:49 by
1.7.2