Apply updated overlay instantenously.
This commit is contained in:
parent
f3e85e8fa0
commit
d0c30c6ad6
2 changed files with 11 additions and 4 deletions
|
@ -383,10 +383,17 @@ void CVideo::initSDL()
|
|||
}
|
||||
|
||||
#ifdef SDL_GPU
|
||||
void CVideo::update_overlay()
|
||||
void CVideo::update_overlay(SDL_Rect *rect)
|
||||
{
|
||||
sdl::timage img(overlay_);
|
||||
shader_.set_overlay(img);
|
||||
|
||||
// Re-render the appropriate screen area so that overlay change is visible
|
||||
static sdl::timage empty(image::get_texture("images/misc/blank.png"));
|
||||
SDL_Rect whole = sdl::create_rect(0, 0, overlay_->w, overlay_->h);
|
||||
SDL_Rect *r = rect == NULL ? &whole : rect;
|
||||
empty.set_scale(float(r->w) / empty.base_width(), float(r->h) / empty.base_height());
|
||||
draw_texture(empty, r->x, r->y);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -442,7 +449,7 @@ void CVideo::blit_to_overlay(surface surf, int x, int y)
|
|||
}
|
||||
SDL_Rect r = sdl::create_rect(x, y, surf->w, surf->h);
|
||||
SDL_BlitSurface(surf, NULL, overlay_, &r);
|
||||
update_overlay();
|
||||
update_overlay(&r);
|
||||
}
|
||||
|
||||
void CVideo::clear_overlay_area(SDL_Rect area)
|
||||
|
@ -455,7 +462,7 @@ void CVideo::clear_overlay_area(SDL_Rect area)
|
|||
pixels[index] = color;
|
||||
}
|
||||
}
|
||||
update_overlay();
|
||||
update_overlay(&area);
|
||||
}
|
||||
|
||||
void CVideo::clear_overlay()
|
||||
|
|
|
@ -185,7 +185,7 @@ private:
|
|||
|
||||
void initSDL();
|
||||
#ifdef SDL_GPU
|
||||
void update_overlay();
|
||||
void update_overlay(SDL_Rect *rect = NULL);
|
||||
|
||||
sdl::shader_program shader_;
|
||||
surface overlay_;
|
||||
|
|
Loading…
Add table
Reference in a new issue