diff --git a/src/panel/weather.cpp b/src/panel/weather.cpp index abb4234..5337093 100644 --- a/src/panel/weather.cpp +++ b/src/panel/weather.cpp @@ -76,23 +76,31 @@ void weather::update() { // _rss void weather::update_texture(){ std::cerr << "WEATHER::UPDATE_TEXTURE\n"; + SDL_Rect tgt; SDL_SetRenderTarget(board::getRenderer(), _texture); - - SDL_Rect tgt; - //title tgt.x = 50; tgt.y = 50; TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 24 }), _rss.getTitle().c_str(), &tgt.w, &tgt.h); - SDL_RenderCopy(board::getRenderer(), board::getString(_rss.getTitle(), { "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); }