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 MotionSensor
Title/Title.h@59:fd4669864b67, 2019-05-09 (annotated)
- Committer:
- el17sm
- Date:
- Thu May 09 14:49:27 2019 +0000
- Revision:
- 59:fd4669864b67
- Parent:
- 58:c8d90bb7404a
wtf y no work
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| el17sm | 32:fe6359ef9916 | 1 | #ifndef TITLE_H |
| el17sm | 32:fe6359ef9916 | 2 | #define TITLE_H |
| el17sm | 32:fe6359ef9916 | 3 | |
| el17sm | 32:fe6359ef9916 | 4 | #include "Player.h" |
| el17sm | 32:fe6359ef9916 | 5 | #include "N5110.h" |
| el17sm | 32:fe6359ef9916 | 6 | #include "Gamepad.h" |
| el17sm | 57:1c12361b6e3d | 7 | /**Title Class |
| el17sm | 59:fd4669864b67 | 8 | *@author Steven Mahasin |
| el17sm | 59:fd4669864b67 | 9 | *@brief Handles all Title Screen Interractions |
| el17sm | 59:fd4669864b67 | 10 | *@date May 2019 |
| el17sm | 57:1c12361b6e3d | 11 | */ |
| el17sm | 32:fe6359ef9916 | 12 | class Title |
| el17sm | 32:fe6359ef9916 | 13 | { |
| el17sm | 32:fe6359ef9916 | 14 | private: |
| el17sm | 32:fe6359ef9916 | 15 | // Member Variables |
| el17sm | 58:c8d90bb7404a | 16 | /** |
| el17sm | 58:c8d90bb7404a | 17 | * @brief a counter that increments per loop, used to detect delays |
| el17sm | 58:c8d90bb7404a | 18 | */ |
| el17sm | 57:1c12361b6e3d | 19 | int _title_count; |
| el17sm | 58:c8d90bb7404a | 20 | /** |
| el17sm | 58:c8d90bb7404a | 21 | * @brief a delay period for the joystick to update another right or left input |
| el17sm | 58:c8d90bb7404a | 22 | */ |
| el17sm | 57:1c12361b6e3d | 23 | int _cursor_timer; |
| el17sm | 58:c8d90bb7404a | 24 | /** |
| el17sm | 58:c8d90bb7404a | 25 | * @brief an integer that stores which option the cursor is on |
| el17sm | 58:c8d90bb7404a | 26 | * @note 0 = Start, 1 = Options, 2 = Credits, 3 = Tutorial |
| el17sm | 58:c8d90bb7404a | 27 | */ |
| el17sm | 57:1c12361b6e3d | 28 | int _title_option; |
| el17sm | 32:fe6359ef9916 | 29 | |
| el17sm | 49:3f83ed62d123 | 30 | // Methods |
| el17sm | 58:c8d90bb7404a | 31 | /** |
| el17sm | 58:c8d90bb7404a | 32 | * @brief This function is used to draw the title screen along with the animations |
| el17sm | 59:fd4669864b67 | 33 | * @param lcd - the screen the title screen is drawn on |
| el17sm | 58:c8d90bb7404a | 34 | */ |
| el17sm | 32:fe6359ef9916 | 35 | void draw_title_screen(N5110 &lcd); |
| el17sm | 58:c8d90bb7404a | 36 | /** |
| el17sm | 58:c8d90bb7404a | 37 | * @brief This function is used to read the gamepad buttons and joystick, interracting with the member variable _title_option |
| el17sm | 59:fd4669864b67 | 38 | * @param gamepad - the gamepad the input is being read from |
| el17sm | 58:c8d90bb7404a | 39 | */ |
| el17sm | 32:fe6359ef9916 | 40 | void title_options_joystick(Gamepad &gamepad); |
| el17sm | 32:fe6359ef9916 | 41 | |
| el17sm | 58:c8d90bb7404a | 42 | /** |
| el17sm | 58:c8d90bb7404a | 43 | * @brief This function is called when the user chooses the title option "Option" |
| el17sm | 59:fd4669864b67 | 44 | * @param lcd - the screen the Options screen is drawn on |
| el17sm | 59:fd4669864b67 | 45 | * @param gamepad - the gamepad used to read the potentiometer |
| el17sm | 59:fd4669864b67 | 46 | * @param player - the player that is being used as a demo for the options screen |
| el17sm | 59:fd4669864b67 | 47 | * @param global_contrast - the global contrast that is being varried to be set for the whole game |
| el17sm | 58:c8d90bb7404a | 48 | */ |
| el17sm | 32:fe6359ef9916 | 49 | void title_option_option(N5110 &lcd, Gamepad &gamepad, Player &player, float &global_contrast); |
| el17sm | 58:c8d90bb7404a | 50 | /** |
| el17sm | 58:c8d90bb7404a | 51 | * @brief This function is called when the user chooses the title option "Credit" |
| el17sm | 59:fd4669864b67 | 52 | * @param lcd - the screen the credits is being displayed on |
| el17sm | 59:fd4669864b67 | 53 | * @param gamepad - the gamepad is used to read when the user decides to exit the credit page (button A) |
| el17sm | 58:c8d90bb7404a | 54 | */ |
| el17sm | 32:fe6359ef9916 | 55 | void title_option_credit(N5110 &lcd, Gamepad &gamepad); |
| el17sm | 58:c8d90bb7404a | 56 | /** |
| el17sm | 58:c8d90bb7404a | 57 | * @brief This function is called when the user chooses the title option "Tutorial" |
| el17sm | 59:fd4669864b67 | 58 | * @param lcd - the screen tutotrial is being displayed on |
| el17sm | 59:fd4669864b67 | 59 | * @param gamepad - the gamepad is used to read when the user decides to go to the next tutorial page (button A) |
| el17sm | 58:c8d90bb7404a | 60 | */ |
| el17sm | 47:6e31b195ce3c | 61 | void title_option_tutorial(N5110 &lcd, Gamepad &gamepad); |
| el17sm | 32:fe6359ef9916 | 62 | |
| el17sm | 58:c8d90bb7404a | 63 | /** |
| el17sm | 58:c8d90bb7404a | 64 | * @brief This function is displays tutorial page 0 |
| el17sm | 59:fd4669864b67 | 65 | * @param lcd - the screen the credits is being displayed on |
| el17sm | 58:c8d90bb7404a | 66 | */ |
| el17sm | 48:f7d9ae3e554d | 67 | void print_tutorial_page_0(N5110 &lcd); |
| el17sm | 58:c8d90bb7404a | 68 | /** |
| el17sm | 58:c8d90bb7404a | 69 | * @brief This function is displays tutorial page 1 |
| el17sm | 59:fd4669864b67 | 70 | * @param lcd - the screen the credits is being displayed on |
| el17sm | 58:c8d90bb7404a | 71 | */ |
| el17sm | 48:f7d9ae3e554d | 72 | void print_tutorial_page_1(N5110 &lcd); |
| el17sm | 58:c8d90bb7404a | 73 | /** |
| el17sm | 58:c8d90bb7404a | 74 | * @brief This function is displays tutorial page 2 |
| el17sm | 59:fd4669864b67 | 75 | * @param lcd - the screen the credits is being displayed on |
| el17sm | 58:c8d90bb7404a | 76 | */ |
| el17sm | 48:f7d9ae3e554d | 77 | void print_tutorial_page_2(N5110 &lcd); |
| el17sm | 48:f7d9ae3e554d | 78 | |
| el17sm | 32:fe6359ef9916 | 79 | public: |
| el17sm | 58:c8d90bb7404a | 80 | /** Constructor */ |
| el17sm | 32:fe6359ef9916 | 81 | Title(); |
| el17sm | 32:fe6359ef9916 | 82 | |
| el17sm | 32:fe6359ef9916 | 83 | // Accessor |
| el17sm | 58:c8d90bb7404a | 84 | /** @brief to get the seed for rand() |
| el17sm | 58:c8d90bb7404a | 85 | * @returns _title_count |
| el17sm | 58:c8d90bb7404a | 86 | */ |
| el17sm | 32:fe6359ef9916 | 87 | int get_seed(); |
| el17sm | 32:fe6359ef9916 | 88 | |
| el17sm | 32:fe6359ef9916 | 89 | // Functions |
| el17sm | 58:c8d90bb7404a | 90 | /** @brief This function runs the whole Title screen, it contains the title loop and calls for the rest of the methods |
| el17sm | 59:fd4669864b67 | 91 | * @param lcd - the screen the Title screen is being displayed on |
| el17sm | 59:fd4669864b67 | 92 | * @param gamepad - the input the Title screen processes |
| el17sm | 59:fd4669864b67 | 93 | * @param global_contrast - the variable that is varied by the Title screen to chance screen contrast |
| el17sm | 58:c8d90bb7404a | 94 | */ |
| el17sm | 32:fe6359ef9916 | 95 | void main(N5110 &lcd, Gamepad &gamepad, float &global_contrast); |
| el17sm | 32:fe6359ef9916 | 96 | }; |
| el17sm | 32:fe6359ef9916 | 97 | |
| el17sm | 32:fe6359ef9916 | 98 | #endif |