Begin weather; add current weather to screen

This commit is contained in:
Tyler Perkins 2021-12-19 19:31:10 -05:00
parent 0f85ff6b53
commit ef4b3bfbf3

View File

@ -76,23 +76,31 @@ void weather::update() {
// _rss // _rss
void weather::update_texture(){ void weather::update_texture(){
std::cerr << "WEATHER::UPDATE_TEXTURE\n"; std::cerr << "WEATHER::UPDATE_TEXTURE\n";
SDL_Rect tgt;
SDL_SetRenderTarget(board::getRenderer(), _texture); SDL_SetRenderTarget(board::getRenderer(), _texture);
SDL_Rect tgt;
//title //title
tgt.x = 50; tgt.x = 50;
tgt.y = 50; tgt.y = 50;
TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 24 }), TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 24 }),
_rss.getTitle().c_str(), _rss.getTitle().c_str(),
&tgt.w, &tgt.h); &tgt.w, &tgt.h);
SDL_RenderCopy(board::getRenderer(), SDL_RenderCopy(board::getRenderer(),
board::getString(_rss.getTitle(), board::getString(_rss.getTitle(),
{ "Roboto_Mono/RobotoMono-Medium.ttf", 24 }), NULL, &tgt); { "Roboto_Mono/RobotoMono-Medium.ttf", 24 }), NULL, &tgt);
//current weather
TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 24 }),
_rss.getItem(0).getTitle().c_str(),
&tgt.w, &tgt.h);
tgt.x = SCREEN_WIDTH / 2 - (tgt.w / 2);
tgt.y = SCREEN_HEIGHT / 2 - (tgt.h / 2);
SDL_RenderCopy(board::getRenderer(),
board::getString(_rss.getItem(0).getTitle().c_str(),
{ "Roboto_Mono/RobotoMono-Medium.ttf", 24 }), NULL, &tgt);
SDL_SetRenderTarget(board::getRenderer(), NULL); SDL_SetRenderTarget(board::getRenderer(), NULL);
} }