Display: restored background drawing

I think we indeed want this to be handled here, since it's the gamemap background,
not the UI's background. Made it a class member.
This commit is contained in:
Charles Dang 2018-03-21 14:14:31 +11:00
parent e1e7f65ec1
commit 72c451d2ae
2 changed files with 9 additions and 7 deletions

View file

@ -1020,9 +1020,11 @@ void display::draw_all_panels()
}
}
#if 0
static void draw_background(const SDL_Rect& area, const std::string& image)
void display::draw_background()
{
const std::string& image = theme_.border().background_image;
SDL_Rect area = map_outside_area();
// No background image, just fill in black.
if(image.empty()) {
sdl::fill_rectangle(area, color_t(0, 0, 0));
@ -1035,10 +1037,8 @@ static void draw_background(const SDL_Rect& area, const std::string& image)
}
// TODO: should probably tile this as before.
SDL_Rect a = area;
CVideo::get_singleton().render_copy(background, nullptr, &a);
video_.render_copy(background, nullptr, &area);
}
#endif
int display::draw_text_in_hex(const map_location& loc,
const std::string& text,
@ -2515,8 +2515,7 @@ void display::draw()
pre_draw();
// Draw theme background.
//const SDL_Rect outside_area = map_outside_area();
//draw_background(outside_area, theme_.border().background_image);
draw_background();
// Progress animations.
invalidate_animations();

View file

@ -857,6 +857,9 @@ protected:
private:
enum TERRAIN_TYPE { FOREGROUND, BACKGROUND };
/** Draws the background behind the gamemap. */
void draw_background();
/** Draws the visible map hex terrains. Used by @ref draw_gamemap. */
void draw_visible_hexes(const rect_of_hexes& visible_hexes, TERRAIN_TYPE layer);