From fcd372fb8230d7521cf59cf7171f6878e27ce0f0 Mon Sep 17 00:00:00 2001 From: landon rohatensky Date: Mon, 25 Sep 2023 11:53:23 -0700 Subject: [PATCH] include apps on screen --- components/homeThing/__init__.py | 8 ++++---- components/homeThingAppCatToy/homeThingCatToyApp.cpp | 7 ++++--- components/homeThingAppSnake/homeThingAppSnake.cpp | 10 +++++++--- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/components/homeThing/__init__.py b/components/homeThing/__init__.py index b5f59f98..0cc3a09c 100644 --- a/components/homeThing/__init__.py +++ b/components/homeThing/__init__.py @@ -351,10 +351,10 @@ async def to_code(config): menu_screen = await menu_screen_to_code(conf) cg.add(menu.register_screen(menu_screen)) - # if CONF_APPS in config: - # for app in config[CONF_APPS]: - # new_app = await cg.get_variable(app) - # cg.add(menu.register_app(new_app)) + if CONF_APPS in config: + for app in config[CONF_APPS]: + new_app = await cg.get_variable(app) + cg.add(menu.register_app(new_app)) await battery_to_code(config, menu) await ids_to_code(config, menu, MENU_IDS) diff --git a/components/homeThingAppCatToy/homeThingCatToyApp.cpp b/components/homeThingAppCatToy/homeThingCatToyApp.cpp index 6bb16781..7e0bc461 100644 --- a/components/homeThingAppCatToy/homeThingCatToyApp.cpp +++ b/components/homeThingAppCatToy/homeThingCatToyApp.cpp @@ -26,14 +26,15 @@ void HomeThingCatToyApp::draw_app( return; } auto largeFont = display_state_->get_font_large(); - auto primaryTextColor = display_state_->primaryTextColor(); + auto primaryTextColor = + display_state_->get_color_palette()->get_accent_primary(); - auto color = Color(128, 0, 128); + auto color = display_state_->get_color_palette()->get_pink(); int yPos = display_buffer_->get_height() * 0.1; display_buffer_->printf(display_buffer_->get_width() * 0.5, yPos, largeFont, color, display::TextAlign::TOP_CENTER, "Cat Toy!"); - color = Color(255, 50, 100); + color = display_state_->get_color_palette()->get_red(); display_buffer_->printf((display_buffer_->get_width() * 0.5) + 1, yPos + 1, largeFont, color, display::TextAlign::TOP_CENTER, "Cat Toy!"); diff --git a/components/homeThingAppSnake/homeThingAppSnake.cpp b/components/homeThingAppSnake/homeThingAppSnake.cpp index f0186f4f..a27af1b1 100644 --- a/components/homeThingAppSnake/homeThingAppSnake.cpp +++ b/components/homeThingAppSnake/homeThingAppSnake.cpp @@ -65,14 +65,18 @@ void HomeThingAppSnake::draw_app( int menuIndex, const std::vector* active_menu) { active_tick(); + auto snakeColor = display_state_->get_color_palette()->get_green(); for (auto segment : snake) { - draw_resized_pixel(segment.x, segment.y, Color(255, 255, 255)); + draw_resized_pixel(segment.x, segment.y, snakeColor); } - draw_resized_pixel(fruit_position_.x, fruit_position_.y, Color(255, 0, 0)); + auto fruitColor = display_state_->get_color_palette()->get_red(); + draw_resized_pixel(fruit_position_.x, fruit_position_.y, fruitColor); + + auto borderColor = display_state_->get_color_palette()->get_accent_primary(); display_buffer_->rectangle( margin, margin + display_state_->get_header_height(), get_display_bounds().x * displayScale, - get_display_bounds().y * displayScale, Color(255, 255, 255)); + get_display_bounds().y * displayScale, borderColor); } void HomeThingAppSnake::idleTick(int idleTime, int display_timeout) {}