Add time to top status bar

This commit is contained in:
Tyler Perkins 2021-12-20 15:33:27 -05:00
parent ad7478cb31
commit 906a6dc65d
2 changed files with 15 additions and 3 deletions

View File

@ -32,6 +32,7 @@ size_t IMAGE_LOCATIONS_LENGTH = sizeof(IMAGE_LOCATIONS)/sizeof(IMAGE_LOCATIONS[0
//};
const FONT_SIZE FONT_LOCATIONS[] = {
{ "Roboto_Mono/RobotoMono-Medium.ttf", 50 },
{ "Roboto_Mono/RobotoMono-Medium.ttf", 28 },
};
size_t FONT_LOCATIONS_LENGTH = sizeof(FONT_LOCATIONS)/sizeof(FONT_LOCATIONS[0]);
@ -43,6 +44,6 @@ size_t FONT_LOCATIONS_LENGTH = sizeof(FONT_LOCATIONS)/sizeof(FONT_LOCATIONS[0]);
//};
const FONT_SIZE_STRING CONST_STRINGS[] = {
//Weather strings
{ "Today's Weather", { "Roboto_Mono/RobotoMono-Medium.ttf", 36 } },
{ "Today's Weather", { "Roboto_Mono/RobotoMono-Medium.ttf", 50 } },
};
size_t CONST_STRINGS_LENGTH = sizeof(CONST_STRINGS)/sizeof(CONST_STRINGS[0]);

View File

@ -106,7 +106,20 @@ void def_overlay::update_texture() {
tgt.h = DEF_OVERLAY_BAR_HEIGHT;
SDL_RenderFillRect(board::getRenderer(), &tgt);
//change to text color
SDL_SetRenderDrawColor(board::getRenderer(),
DEF_OVERLAY_TEXT_RED, DEF_OVERLAY_TEXT_GREEN,
DEF_OVERLAY_TEXT_BLUE, DEF_OVERLAY_TEXT_ALPHA);
//show the date and time
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;
SDL_RenderCopy(board::getRenderer(),
board::getString(date_time.c_str(),
{ "Roboto_Mono/RobotoMono-Medium.ttf", 28 }), NULL, &tgt);
@ -117,8 +130,6 @@ void def_overlay::update_texture() {
//reset back to the old render color
SDL_SetRenderDrawColor(board::getRenderer(),
o_red, o_green, o_blue, o_alpha);
std::cerr << "Leaving overlay texture\n";
}
///////////////////////////////////////