change color upon game over
This commit is contained in:
parent
f12d5105c1
commit
2cd4b8bb5b
@ -530,7 +530,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
|
|||||||
currentScreen = std::make_unique<Screens::Paddle>(lvgl);
|
currentScreen = std::make_unique<Screens::Paddle>(lvgl);
|
||||||
break;
|
break;
|
||||||
case Apps::Bird:
|
case Apps::Bird:
|
||||||
currentScreen = std::make_unique<Screens::Bird>(lvgl);
|
currentScreen = std::make_unique<Screens::Bird>();
|
||||||
break;
|
break;
|
||||||
case Apps::Music:
|
case Apps::Music:
|
||||||
currentScreen = std::make_unique<Screens::Music>(systemTask->nimble().music());
|
currentScreen = std::make_unique<Screens::Music>(systemTask->nimble().music());
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
using namespace Pinetime::Applications::Screens;
|
using namespace Pinetime::Applications::Screens;
|
||||||
|
|
||||||
Bird::Bird(Pinetime::Components::LittleVgl& lvgl) : lvgl {lvgl} {
|
Bird::Bird() {
|
||||||
|
|
||||||
lv_obj_t* background = lv_obj_create(lv_scr_act(), nullptr);
|
lv_obj_t* background = lv_obj_create(lv_scr_act(), nullptr);
|
||||||
lv_obj_set_size(background, LV_HOR_RES, LV_VER_RES);
|
lv_obj_set_size(background, LV_HOR_RES, LV_VER_RES);
|
||||||
@ -110,9 +110,10 @@ void Bird::Refresh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Bird::GameOver() {
|
void Bird::GameOver() {
|
||||||
|
is_stopped = true;
|
||||||
lv_label_set_text_static(info, "Game Over");
|
lv_label_set_text_static(info, "Game Over");
|
||||||
lv_obj_align(info, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 40);
|
lv_obj_align(info, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 40);
|
||||||
is_stopped = true;
|
lv_obj_set_style_local_text_color(bird, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,6 +123,7 @@ bool Bird::OnTouchEvent(Pinetime::Applications::TouchEvents /*event*/) {
|
|||||||
pos = 120;
|
pos = 120;
|
||||||
lv_label_set_text_static(info, "Touch to Start");
|
lv_label_set_text_static(info, "Touch to Start");
|
||||||
lv_obj_align(info, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 40);
|
lv_obj_align(info, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 40);
|
||||||
|
lv_obj_set_style_local_text_color(bird, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// reset
|
// reset
|
||||||
|
@ -20,7 +20,7 @@ namespace Pinetime {
|
|||||||
|
|
||||||
class Bird : public Screen {
|
class Bird : public Screen {
|
||||||
public:
|
public:
|
||||||
Bird(Pinetime::Components::LittleVgl& lvgl);
|
Bird();
|
||||||
~Bird() override;
|
~Bird() override;
|
||||||
|
|
||||||
void Refresh() override;
|
void Refresh() override;
|
||||||
@ -31,7 +31,6 @@ namespace Pinetime {
|
|||||||
private:
|
private:
|
||||||
void GameOver();
|
void GameOver();
|
||||||
void MovePipe();
|
void MovePipe();
|
||||||
Pinetime::Components::LittleVgl& lvgl;
|
|
||||||
|
|
||||||
bool is_stopped = true;
|
bool is_stopped = true;
|
||||||
bool is_ascending = false;
|
bool is_ascending = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user