From 163b85d206530fc4fc954d7bf8f8db6a5a0f2c1c Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 25 Feb 2021 15:26:12 -0800 Subject: [PATCH] Add ClearSurface() This is a function that does what it says - it clears the given surface. This just means doing a FillRect(), but it's better to use this function because it conveys intent better. --- desktop_version/src/GraphicsUtil.cpp | 5 +++++ desktop_version/src/GraphicsUtil.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/desktop_version/src/GraphicsUtil.cpp b/desktop_version/src/GraphicsUtil.cpp index 3fbcf8d3..fdcf179a 100644 --- a/desktop_version/src/GraphicsUtil.cpp +++ b/desktop_version/src/GraphicsUtil.cpp @@ -390,6 +390,11 @@ void FillRect( SDL_Surface* _surface, SDL_Rect rect, int rgba ) SDL_FillRect(_surface, &rect, rgba); } +void ClearSurface(SDL_Surface* surface) +{ + SDL_FillRect(surface, NULL, 0x00000000); +} + void ScrollSurface( SDL_Surface* _src, int _pX, int _pY ) { SDL_Surface* part1 = NULL; diff --git a/desktop_version/src/GraphicsUtil.h b/desktop_version/src/GraphicsUtil.h index d558eccb..2ffa4461 100644 --- a/desktop_version/src/GraphicsUtil.h +++ b/desktop_version/src/GraphicsUtil.h @@ -35,6 +35,8 @@ void FillRect( SDL_Surface* surface, SDL_Rect& rect, const int r, int g, int b ) void FillRect( SDL_Surface* surface, SDL_Rect rect, int rgba ); +void ClearSurface(SDL_Surface* surface); + void ScrollSurface(SDL_Surface* _src, int pX, int py); SDL_Surface * FlipSurfaceVerticle(SDL_Surface* _src);