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
Diff: shot/shot.h
- Revision:
- 13:eb60628db8bf
- Parent:
- 11:494cc44777fe
- Child:
- 15:3571beaaeed8
diff -r 009895f6b6e4 -r eb60628db8bf shot/shot.h --- a/shot/shot.h Mon May 11 14:43:16 2020 +0000 +++ b/shot/shot.h Thu May 14 16:45:20 2020 +0000 @@ -9,11 +9,11 @@ #include <stdlib.h> /** shot class - @set several kinds of shot and come from all around - @author Zeyu Feng - @13 April 2020 - */ - +@set several kinds of shot and come from all around +@author Zeyu Feng +@13 April 2020 +*/ +/**struct of shot position type and direction*/ struct shot_posandtype { int x; int y; @@ -25,33 +25,51 @@ { public: - //constructor + + /**constructor*/ shot(); - //destructor + /**destructor*/ ~shot(); - //generate first 10 shots + /**generate first 10 shots*/ void init(); - //random pos + + /**produce a random_pos(21,0)(42,0)(63,0)(21,45)(42,45)(63,45) + *@param vector_i(shot_posandtype*) + */ void init_pos(shot_posandtype* i); - //increase number of shots along with time - void init_shot(); - //moving function - void update(); - + + /**move shots in their own directions*/ + void update(N5110 &lcd); + + /**generate shots as time goes on*/ + void update_shot(); + + /**draw updated shots*/ void draw(N5110 &lcd); - //if beyoud border, delete it and generate new one, keep total number constant + + /**if beyoud border, delete it and generate new one, keep total number constant*/ void delete_shot(); - //accessors + /**control difficulty of game(size) + *@param timerflag(int) + *@param increment(float) + *@param max(int) + */ + void gen_shot(int timer_flag, float increment, int max); + + /**accessors resize shots + *@param size(int) + */ void set_size(int size); - ////mutators + + /**mutators get size + *@return current size + */ int get_size(); - - void gen_shot(int timer_flag, float increment, int max); private: std::vector<shot_posandtype> _p; - int _size; + float _size_f; }; #endif