Add and show weather icons

This commit is contained in:
Tyler Perkins
2021-12-22 19:14:41 -05:00
parent 036b8a8bc9
commit 6215d7701e
18 changed files with 66 additions and 15 deletions

View File

@@ -170,6 +170,7 @@ void weather::update_texture(){
SDL_RenderCopy(board::getRenderer(),
board::getString(temp.c_str(),
{ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), NULL, &tgt);
//tommorow's weather
@@ -202,6 +203,16 @@ void weather::update_texture(){
SDL_RenderCopy(board::getRenderer(),
board::getString(temp.c_str(),
{ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), NULL, &tgt);
//icon
tgt.w = (SCREEN_WIDTH / 3) - 50;
tgt.h = tgt.w;
tgt.y = DEF_OVERLAY_BAR_HEIGHT + 25;
tgt.x = 0;
SDL_RenderCopy(board::getRenderer(),
board::getImage(weather_tommorow->second),
NULL, &tgt);
//day after's weather
TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }),
@@ -233,8 +244,17 @@ void weather::update_texture(){
SDL_RenderCopy(board::getRenderer(),
board::getString(temp.c_str(),
{ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), NULL, &tgt);
//icon
tgt.w = (SCREEN_WIDTH / 3) - 50;
tgt.h = tgt.w;
tgt.y = DEF_OVERLAY_BAR_HEIGHT + 25;
tgt.x = (2*SCREEN_WIDTH / 3);
std::cerr << "WEATHER DAY AFTER " << weather_day_after->second << "\n";
std::cerr << board::getImage(weather_day_after->second) << "\n";
SDL_RenderCopy(board::getRenderer(),
board::getImage(weather_day_after->second),
NULL, &tgt);
SDL_SetRenderTarget(board::getRenderer(), NULL);
}

View File

@@ -8,6 +8,7 @@
#include <utility>
#include <string>
#include "def_overlay_config.hpp"
namespace dashboard::panel {
//This will be displayed at the top left on the status bar. Set to a blank
@@ -41,14 +42,14 @@ namespace dashboard::panel {
{"Clear skies", "clearnight.png"};
const std::pair<std::string, std::string> WEATHER_PCLOUDY_DAY =
{"Slightly cloudy", "pcloudyday.png"};
{"Slightly cloudy", "cloudyday.png"};
const std::pair<std::string, std::string> WEATHER_PCLOUDY_NIGHT =
{"Slightly cloudy", "pcloudynight.png"};
{"Slightly cloudy", "cloudynight.png"};
const std::pair<std::string, std::string> WEATHER_MCLOUDY_DAY =
{"Moderately cloudy", "mcloudyday.png"};
{"Moderately cloudy", "cloudyday.png"};
const std::pair<std::string, std::string> WEATHER_MCLOUDY_NIGHT =
{"Moderately cloudy", "mcloudynight.png"};
{"Moderately cloudy", "cloudynight.png"};
const std::pair<std::string, std::string> WEATHER_CLOUDY_DAY =
{"Very cloudy", "cloudyday.png"};
@@ -71,19 +72,19 @@ namespace dashboard::panel {
{"Rain", "rainnight.png"};
const std::pair<std::string, std::string> WEATHER_OSHOWER_DAY =
{"Overcast with showers", "oshowerday.png"};
{"Overcast with showers", "shower.png"};
const std::pair<std::string, std::string> WEATHER_OSHOWER_NIGHT =
{"Overcast with showers", "oshowernight.png"};
{"Overcast with showers", "shower.png"};
const std::pair<std::string, std::string> WEATHER_ISHOWER_DAY =
{"Moderate showers", "ishowerday.png"};
{"Moderate showers", "shower.png"};
const std::pair<std::string, std::string> WEATHER_ISHOWER_NIGHT =
{"Moderate showers", "ishowernight.png"};
{"Moderate showers", "shower.png"};
const std::pair<std::string, std::string> WEATHER_LSNOW_DAY =
{"Light snow", "lsnowday.png"};
{"Light snow", "snowday.png"};
const std::pair<std::string, std::string> WEATHER_LSNOW_NIGHT =
{"Light snow", "lsnownight.png"};
{"Light snow", "snownight.png"};
const std::pair<std::string, std::string> WEATHER_SNOW_DAY =
{"Moderate snow", "snowday.png"};
@@ -91,7 +92,7 @@ namespace dashboard::panel {
{"Moderate snow", "snownight.png"};
const std::pair<std::string, std::string> WEATHER_RAINSNOW_DAY =
{"Rain and snow", "rainsnowday.png"};
{"Rain and snow", "rainsnow.png"};
const std::pair<std::string, std::string> WEATHER_RAINSNOW_NIGHT =
{"Rain and snow", "rainsnownight.png"};
{"Rain and snow", "rainsnow.png"};
}