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
Diff: Title/Title.cpp
- Revision:
- 57:1c12361b6e3d
- Parent:
- 50:2c5cb92a5361
--- a/Title/Title.cpp Thu May 09 08:42:52 2019 +0000
+++ b/Title/Title.cpp Thu May 09 09:50:19 2019 +0000
@@ -2,35 +2,35 @@
Title::Title()
{
- title_count = 0;
- cursor_timer = 20;
- title_option = 0;
+ _title_count = 0;
+ _cursor_timer = 20;
+ _title_option = 0;
}
int Title::get_seed()
{
- return title_count;
+ return _title_count;
}
void Title::main(N5110 &lcd, Gamepad &gamepad, float &global_contrast)
{
Player player(5, 36);
while(1){ // Title Screen Loop
- title_option = 0;
+ _title_option = 0;
while(!gamepad.check_event(Gamepad::A_PRESSED)){
lcd.clear();
draw_title_screen(lcd);
lcd.refresh();
title_options_joystick(gamepad);
- title_count++;
+ _title_count++;
wait_ms(1000/40); // 1s/framerate
}
while(gamepad.check_event(Gamepad::A_PRESSED)){}
- if(title_option == 0) { break; // Start game, exit title loop
- } else if (title_option == 1) { title_option_option(lcd, gamepad, player, global_contrast);
- } else if (title_option == 2) { title_option_credit(lcd, gamepad);
- } else if (title_option == 3) { title_option_tutorial(lcd, gamepad);
+ if(_title_option == 0) { break; // Start game, exit title loop
+ } else if (_title_option == 1) { title_option_option(lcd, gamepad, player, global_contrast);
+ } else if (_title_option == 2) { title_option_credit(lcd, gamepad);
+ } else if (_title_option == 3) { title_option_tutorial(lcd, gamepad);
}
}
player.~Player();
@@ -42,32 +42,32 @@
lcd.drawSpriteTransparent(19, 14, 17, 53, (char *)title_name_1);
lcd.drawCircle(79, 7, 10, FILL_BLACK);
lcd.drawCircle(81, 5, 8, FILL_WHITE);
- lcd.drawSprite(56, 6, 11, 5, (char *)star_sprite[abs(((title_count/20) % 7) - 3)]);
+ lcd.drawSprite(56, 6, 11, 5, (char *)star_sprite[abs(((_title_count/20) % 7) - 3)]);
lcd.drawSprite(12, 34, 8, 8, (char *)button_A_sprite);
lcd.drawSprite(22, 37, 3, 2, (char *)arrow_left_sprite);
lcd.drawSprite(59, 37, 3, 2, (char *)arrow_right_sprite);
- lcd.drawSprite(69, 31, 12, 6, (char *)sprite_player[(title_count/40) % 4][(title_count/10) % 4]);
- lcd.drawSprite(26, 35, 9, 32, (char *)title_options_sprite[title_option]);
+ lcd.drawSprite(69, 31, 12, 6, (char *)sprite_player[(_title_count/40) % 4][(_title_count/10) % 4]);
+ lcd.drawSprite(26, 35, 9, 32, (char *)title_options_sprite[_title_option]);
}
void Title::title_options_joystick(Gamepad &gamepad)
{
- if ((gamepad.get_direction() == 3) && (cursor_timer > 20)) { // Detect Joystick going right
- cursor_timer = 0;
- if (title_option >= 3) {
- title_option = 0;
+ if ((gamepad.get_direction() == 3) && (_cursor_timer > 20)) { // Detect Joystick going right
+ _cursor_timer = 0;
+ if (_title_option >= 3) {
+ _title_option = 0;
} else {
- title_option++;
+ _title_option++;
}
- } else if ((gamepad.get_direction() == 7) && (cursor_timer > 20)) { // Detect Joystick going left
- cursor_timer = 0;
- if (title_option <= 0) {
- title_option = 3;
+ } else if ((gamepad.get_direction() == 7) && (_cursor_timer > 20)) { // Detect Joystick going left
+ _cursor_timer = 0;
+ if (_title_option <= 0) {
+ _title_option = 3;
} else {
- title_option--;
+ _title_option--;
}
}
- cursor_timer++;
+ _cursor_timer++;
}
void Title::title_option_option(N5110 &lcd, Gamepad &gamepad, Player &player, float &global_contrast)