Li Ruofan 201199450
Dependencies: mbed Gamepad Joystick
homepage/homepage.h@5:e3a9f0548922, 2020-05-15 (annotated)
- Committer:
- DannyLee
- Date:
- Fri May 15 19:57:40 2020 +0000
- Revision:
- 5:e3a9f0548922
- Child:
- 6:cbd9e1f26a10
need to debug
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DannyLee | 5:e3a9f0548922 | 1 | #ifndef Menu_H |
DannyLee | 5:e3a9f0548922 | 2 | #define Menu_H |
DannyLee | 5:e3a9f0548922 | 3 | |
DannyLee | 5:e3a9f0548922 | 4 | #include "mbed.h" |
DannyLee | 5:e3a9f0548922 | 5 | #include "N5110.h" |
DannyLee | 5:e3a9f0548922 | 6 | #include "Joystick.h" |
DannyLee | 5:e3a9f0548922 | 7 | #include "Bitmap.h" |
DannyLee | 5:e3a9f0548922 | 8 | #include "Sound.h" |
DannyLee | 5:e3a9f0548922 | 9 | /** Homepage Class |
DannyLee | 5:e3a9f0548922 | 10 | @brief Library for different pages in the screen of mbed, University of Leeds |
DannyLee | 5:e3a9f0548922 | 11 | @author Li Ruofan |
DannyLee | 5:e3a9f0548922 | 12 | @date May 2020 |
DannyLee | 5:e3a9f0548922 | 13 | */ |
DannyLee | 5:e3a9f0548922 | 14 | class Homepage{ |
DannyLee | 5:e3a9f0548922 | 15 | |
DannyLee | 5:e3a9f0548922 | 16 | public: |
DannyLee | 5:e3a9f0548922 | 17 | /** Constructor */ |
DannyLee | 5:e3a9f0548922 | 18 | Homepage(); |
DannyLee | 5:e3a9f0548922 | 19 | /** Destructor */ |
DannyLee | 5:e3a9f0548922 | 20 | ~Homepage(); |
DannyLee | 5:e3a9f0548922 | 21 | /** The welcome functions including lcd,leds and sound |
DannyLee | 5:e3a9f0548922 | 22 | * @param lcd (N5110) |
DannyLee | 5:e3a9f0548922 | 23 | * @param stream of output bits to control leds (Busout) |
DannyLee | 5:e3a9f0548922 | 24 | * @param the welcome song (Sound) |
DannyLee | 5:e3a9f0548922 | 25 | */ |
DannyLee | 5:e3a9f0548922 | 26 | void welcome(N5110 &lcd,BusOut &output,Bgm &bgm); |
DannyLee | 5:e3a9f0548922 | 27 | |
DannyLee | 5:e3a9f0548922 | 28 | /** The over functions including lcd and leds |
DannyLee | 5:e3a9f0548922 | 29 | * @param lcd (N5110) |
DannyLee | 5:e3a9f0548922 | 30 | * @param a stream of output bits to control leds (Busout) |
DannyLee | 5:e3a9f0548922 | 31 | */ |
DannyLee | 5:e3a9f0548922 | 32 | void over(N5110 &lcd,BusOut &output); |
DannyLee | 5:e3a9f0548922 | 33 | |
DannyLee | 5:e3a9f0548922 | 34 | /** The over functions including lcd and leds |
DannyLee | 5:e3a9f0548922 | 35 | * @param lcd (N5110) |
DannyLee | 5:e3a9f0548922 | 36 | * @param the button A (InterruptIn) |
DannyLee | 5:e3a9f0548922 | 37 | * @param the button B (InterruptIn) |
DannyLee | 5:e3a9f0548922 | 38 | * @param the start button (InterruptIn) |
DannyLee | 5:e3a9f0548922 | 39 | */ |
DannyLee | 5:e3a9f0548922 | 40 | void homepage(N5110 &lcd,InterruptIn &buttonA,InterruptIn &buttonB, InterruptIn &start, int *score,int n); |
DannyLee | 5:e3a9f0548922 | 41 | |
DannyLee | 5:e3a9f0548922 | 42 | /** The rangking lists |
DannyLee | 5:e3a9f0548922 | 43 | * @param lcd (N5110) |
DannyLee | 5:e3a9f0548922 | 44 | * @param the vector of scores in the history (int) |
DannyLee | 5:e3a9f0548922 | 45 | * @param the size of score vector (int) |
DannyLee | 5:e3a9f0548922 | 46 | */ |
DannyLee | 5:e3a9f0548922 | 47 | |
DannyLee | 5:e3a9f0548922 | 48 | void displayCurScore(N5110 &lcd,int score); |
DannyLee | 5:e3a9f0548922 | 49 | |
DannyLee | 5:e3a9f0548922 | 50 | /** Draw images including a plane, a bullet and an enemy in the welcome page |
DannyLee | 5:e3a9f0548922 | 51 | * @param lcd (N5110) |
DannyLee | 5:e3a9f0548922 | 52 | * @param the value of score (int) |
DannyLee | 5:e3a9f0548922 | 53 | */ |
DannyLee | 5:e3a9f0548922 | 54 | void drawEverything(N5110 &lcd); |
DannyLee | 5:e3a9f0548922 | 55 | |
DannyLee | 5:e3a9f0548922 | 56 | |
DannyLee | 5:e3a9f0548922 | 57 | /** Display rules of the game |
DannyLee | 5:e3a9f0548922 | 58 | * @param lcd (N5110) |
DannyLee | 5:e3a9f0548922 | 59 | * @param the button B (InterruptIn) |
DannyLee | 5:e3a9f0548922 | 60 | */ |
DannyLee | 5:e3a9f0548922 | 61 | void rules(N5110 &lcd,InterruptIn &buttonA,InterruptIn &buttonB); |
DannyLee | 5:e3a9f0548922 | 62 | |
DannyLee | 5:e3a9f0548922 | 63 | |
DannyLee | 5:e3a9f0548922 | 64 | /**Play again the game when score > 10 |
DannyLee | 5:e3a9f0548922 | 65 | * Back when score <=10 |
DannyLee | 5:e3a9f0548922 | 66 | * @param lcd (N5110) |
DannyLee | 5:e3a9f0548922 | 67 | * @param total score in one game (int) |
DannyLee | 5:e3a9f0548922 | 68 | * @param the button X (InterruptIn) |
DannyLee | 5:e3a9f0548922 | 69 | * @param the button Y (InterruptIn) |
DannyLee | 5:e3a9f0548922 | 70 | * @return the score that need to be added to the previous one |
DannyLee | 5:e3a9f0548922 | 71 | */ |
DannyLee | 5:e3a9f0548922 | 72 | int again(N5110 &lcd,int score,InterruptIn &buttonX,InterruptIn &buttonY); |
DannyLee | 5:e3a9f0548922 | 73 | private: |
DannyLee | 5:e3a9f0548922 | 74 | }; |
DannyLee | 5:e3a9f0548922 | 75 | #endif |