From 8d8751e4d8eaae849bfd423fd5793527490a70e4 Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Mon, 20 Dec 2021 15:56:03 -0500 Subject: [PATCH] Add proper clock and colors --- src/board.cpp | 16 +++++++--------- src/panel/def_overlay.cpp | 5 ++--- src/panel/def_overlay_config.hpp | 12 ++++++------ src/panel/weather.cpp | 2 +- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/board.cpp b/src/board.cpp index 52f060a..72a1fad 100644 --- a/src/board.cpp +++ b/src/board.cpp @@ -368,27 +368,25 @@ void board::start(){ SDL_RenderClear(_renderer); //PLACEHOLDER, cycle color - /* { - static uint8_t red = 0; + static uint8_t green = 0; static bool up = true; - SDL_SetRenderDrawColor(_renderer, red, - BOARD_GREEN, BOARD_BLUE, SDL_ALPHA_OPAQUE); + SDL_SetRenderDrawColor(_renderer, BOARD_RED, + green, BOARD_BLUE, SDL_ALPHA_OPAQUE); SDL_RenderClear(_renderer); if(up){ - if(red == 254) + if(green == 254) up = false; - red++; + green++; } else { - if(red == 1) + if(green == 1) up = true; - red --; + green --; } } - */ //END PLACEHOLDER diff --git a/src/panel/def_overlay.cpp b/src/panel/def_overlay.cpp index 39be18e..7459514 100644 --- a/src/panel/def_overlay.cpp +++ b/src/panel/def_overlay.cpp @@ -115,8 +115,8 @@ void def_overlay::update_texture() { TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 28 }), date_time.c_str(), &tgt.w, &tgt.h); - tgt.x = SCREEN_WIDTH - tgt.w - 5; - tgt.y = 0; + tgt.x = SCREEN_WIDTH - tgt.w + 25; + tgt.y = -5; SDL_RenderCopy(board::getRenderer(), board::getString(date_time.c_str(), { "Roboto_Mono/RobotoMono-Medium.ttf", 28 }), NULL, &tgt); @@ -124,7 +124,6 @@ void def_overlay::update_texture() { - SDL_SetRenderTarget(board::getRenderer(), NULL); //reset back to the old render color diff --git a/src/panel/def_overlay_config.hpp b/src/panel/def_overlay_config.hpp index 9ba9a7a..216c4b5 100644 --- a/src/panel/def_overlay_config.hpp +++ b/src/panel/def_overlay_config.hpp @@ -11,10 +11,10 @@ namespace dashboard::panel { //How long should we wait between updates? in ms //Default 10 s - constexpr size_t DEF_OVERLAY_UPDATE_INTERVAL = 10000; + constexpr size_t DEF_OVERLAY_UPDATE_INTERVAL = 500; //Height of the bar on the top and bottom, in pixels - constexpr size_t DEF_OVERLAY_BAR_HEIGHT = 45; + constexpr size_t DEF_OVERLAY_BAR_HEIGHT = 60; //Text color constexpr uint8_t DEF_OVERLAY_TEXT_RED = 0xCC; @@ -22,8 +22,8 @@ namespace dashboard::panel { constexpr uint8_t DEF_OVERLAY_TEXT_BLUE = 0xCC; constexpr uint8_t DEF_OVERLAY_TEXT_ALPHA = 0xFF; - constexpr uint8_t DEF_OVERLAY_BAR_RED = 0xAA; - constexpr uint8_t DEF_OVERLAY_BAR_GREEN = 0xAA; - constexpr uint8_t DEF_OVERLAY_BAR_BLUE = 0xAA; - constexpr uint8_t DEF_OVERLAY_BAR_ALPHA = 0xFF; + constexpr uint8_t DEF_OVERLAY_BAR_RED = 0x00; + constexpr uint8_t DEF_OVERLAY_BAR_GREEN = 0x00; + constexpr uint8_t DEF_OVERLAY_BAR_BLUE = 0x00; + constexpr uint8_t DEF_OVERLAY_BAR_ALPHA = 0xCC; } diff --git a/src/panel/weather.cpp b/src/panel/weather.cpp index b60651f..a1b085f 100644 --- a/src/panel/weather.cpp +++ b/src/panel/weather.cpp @@ -132,6 +132,6 @@ void weather::initTexture(){ SDL_TEXTUREACCESS_TARGET, SCREEN_WIDTH, SCREEN_HEIGHT); - SDL_SetTextureBlendMode(_texture, SDL_BLENDMODE_NONE); + SDL_SetTextureBlendMode(_texture, SDL_BLENDMODE_BLEND); } }