Add background image to weather
This commit is contained in:
parent
076b905c72
commit
14cf97ac33
BIN
img/rainy.png
BIN
img/rainy.png
Binary file not shown.
Before Width: | Height: | Size: 6.5 KiB |
BIN
img/sky.png
Normal file
BIN
img/sky.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
BIN
img/square.png
Normal file
BIN
img/square.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
img/sunny.png
BIN
img/sunny.png
Binary file not shown.
Before Width: | Height: | Size: 58 KiB |
@ -21,6 +21,7 @@ dashboard::panel::panel* OVERLAY = new dashboard::panel::def_overlay();
|
||||
// Locations of all static images used
|
||||
const char* IMAGE_LOCATIONS[] = {
|
||||
"bmp_24.png",
|
||||
"sky.png",
|
||||
};
|
||||
size_t IMAGE_LOCATIONS_LENGTH = sizeof(IMAGE_LOCATIONS)/sizeof(IMAGE_LOCATIONS[0]);
|
||||
|
||||
|
@ -37,7 +37,6 @@ def_overlay::~def_overlay(){
|
||||
void def_overlay::draw(){
|
||||
//create the texture if this is the first time running draw
|
||||
if(_texture == nullptr){
|
||||
std::cerr << "IN FIRST SETUP\n";
|
||||
initTexture();
|
||||
update();
|
||||
update_texture();
|
||||
@ -89,6 +88,8 @@ void def_overlay::update_texture() {
|
||||
SDL_SetRenderDrawColor(board::getRenderer(),
|
||||
0x00, 0x00, 0x00, 0x00);
|
||||
|
||||
SDL_RenderClear(board::getRenderer());
|
||||
|
||||
//set the new color
|
||||
SDL_SetRenderDrawColor(board::getRenderer(),
|
||||
DEF_OVERLAY_BAR_RED, DEF_OVERLAY_BAR_GREEN,
|
||||
@ -112,16 +113,14 @@ void def_overlay::update_texture() {
|
||||
DEF_OVERLAY_TEXT_BLUE, DEF_OVERLAY_TEXT_ALPHA);
|
||||
|
||||
//show the date and time
|
||||
TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 28 }),
|
||||
TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }),
|
||||
date_time.c_str(),
|
||||
&tgt.w, &tgt.h);
|
||||
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);
|
||||
|
||||
|
||||
{ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), NULL, &tgt);
|
||||
|
||||
|
||||
SDL_SetRenderTarget(board::getRenderer(), NULL);
|
||||
|
@ -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 = 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;
|
||||
constexpr uint8_t DEF_OVERLAY_BAR_RED = 0xD3;
|
||||
constexpr uint8_t DEF_OVERLAY_BAR_GREEN = 0xD3;
|
||||
constexpr uint8_t DEF_OVERLAY_BAR_BLUE = 0xD3;
|
||||
constexpr uint8_t DEF_OVERLAY_BAR_ALPHA = 0x7F;
|
||||
}
|
||||
|
@ -88,6 +88,10 @@ void weather::update_texture(){
|
||||
SDL_SetRenderTarget(board::getRenderer(), _texture);
|
||||
SDL_RenderClear(board::getRenderer());
|
||||
|
||||
//background image
|
||||
SDL_RenderCopy(board::getRenderer(),
|
||||
board::getImage("sky.png"), NULL, NULL);
|
||||
|
||||
//title
|
||||
tgt.x = 50;
|
||||
tgt.y = 50;
|
||||
|
Loading…
Reference in New Issue
Block a user