mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Change all surface-clearing FillRect()s to use ClearSurface()
ClearSurface() is less verbose than doing it the old way, and also conveys intent clearer. Plus, some of these FillRect()s had hardcoded width and height values, whereas ClearSurface() doesn't - meaning this change also has better future-proofing, in case the widths and heights of the surfaces involved change in the future.
This commit is contained in:
parent
e545c89b5e
commit
38d5664601
7 changed files with 30 additions and 30 deletions
|
@ -1304,7 +1304,7 @@ void Graphics::drawfade(void)
|
|||
int usethisamount = lerp(oldfadeamount, fadeamount);
|
||||
if ((fademode == 1)||(fademode == 4))
|
||||
{
|
||||
FillRect(backBuffer, 0, 0, backBuffer->w, backBuffer->h, 0x000000);
|
||||
ClearSurface(backBuffer);
|
||||
}
|
||||
else if(fademode==3)
|
||||
{
|
||||
|
@ -2005,7 +2005,7 @@ void Graphics::drawbackground( int t )
|
|||
{
|
||||
case 1:
|
||||
//Starfield
|
||||
FillRect(backBuffer,0x00000);
|
||||
ClearSurface(backBuffer);
|
||||
for (int i = 0; i < numstars; i++)
|
||||
{
|
||||
stars[i].w = 2;
|
||||
|
@ -2174,13 +2174,13 @@ void Graphics::drawbackground( int t )
|
|||
break;
|
||||
}
|
||||
case 3: //Warp zone (horizontal)
|
||||
FillRect(backBuffer, 0x000000);
|
||||
ClearSurface(backBuffer);
|
||||
BlitSurfaceStandard(warpbuffer, NULL, warpbuffer_lerp, NULL);
|
||||
ScrollSurface(warpbuffer_lerp, lerp(0, -3), 0);
|
||||
BlitSurfaceStandard(warpbuffer_lerp, &towerbuffer_rect, backBuffer, NULL);
|
||||
break;
|
||||
case 4: //Warp zone (vertical)
|
||||
FillRect(backBuffer, 0x000000);
|
||||
ClearSurface(backBuffer);
|
||||
SDL_BlitSurface(warpbuffer, NULL, warpbuffer_lerp, NULL);
|
||||
ScrollSurface(warpbuffer_lerp, 0, lerp(0, -3));
|
||||
SDL_BlitSurface(warpbuffer_lerp, &towerbuffer_rect, backBuffer, NULL);
|
||||
|
@ -2239,7 +2239,7 @@ void Graphics::drawbackground( int t )
|
|||
break;
|
||||
case 6:
|
||||
//Final Starfield
|
||||
FillRect(backBuffer,0x000000);
|
||||
ClearSurface(backBuffer);
|
||||
for (int i = 0; i < numstars; i++)
|
||||
{
|
||||
stars[i].w = 2;
|
||||
|
@ -2287,7 +2287,7 @@ void Graphics::drawbackground( int t )
|
|||
}
|
||||
break;
|
||||
default:
|
||||
FillRect(backBuffer, 0x000000 );
|
||||
ClearSurface(backBuffer);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -2376,7 +2376,7 @@ void Graphics::updatebackground(int t)
|
|||
{
|
||||
//draw the whole thing for the first time!
|
||||
backoffset = 0;
|
||||
FillRect(warpbuffer, 0x000000);
|
||||
ClearSurface(warpbuffer);
|
||||
for (int j = 0; j < 15; j++)
|
||||
{
|
||||
for (int i = 0; i < 21; i++)
|
||||
|
@ -2415,7 +2415,7 @@ void Graphics::updatebackground(int t)
|
|||
{
|
||||
//draw the whole thing for the first time!
|
||||
backoffset = 0;
|
||||
FillRect(warpbuffer,0x000000 );
|
||||
ClearSurface(warpbuffer);
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
for (int i = 0; i < 21; i++)
|
||||
|
@ -2462,7 +2462,7 @@ void Graphics::drawmap(void)
|
|||
{
|
||||
if (!foregrounddrawn)
|
||||
{
|
||||
FillRect(foregroundBuffer, 0x00000000);
|
||||
ClearSurface(foregroundBuffer);
|
||||
if(map.tileset==0)
|
||||
{
|
||||
for (int j = 0; j < 30; j++)
|
||||
|
@ -2502,7 +2502,7 @@ void Graphics::drawmap(void)
|
|||
void Graphics::drawfinalmap(void)
|
||||
{
|
||||
if (!foregrounddrawn) {
|
||||
FillRect(foregroundBuffer, 0x00000000);
|
||||
ClearSurface(foregroundBuffer);
|
||||
if(map.tileset==0){
|
||||
for (int j = 0; j < 30; j++) {
|
||||
for (int i = 0; i < 40; i++) {
|
||||
|
@ -2551,7 +2551,7 @@ void Graphics::drawtowerspikes(void)
|
|||
|
||||
void Graphics::drawtowerbackground(const TowerBG& bg_obj)
|
||||
{
|
||||
FillRect(backBuffer, 0x000000);
|
||||
ClearSurface(backBuffer);
|
||||
SDL_BlitSurface(bg_obj.buffer, NULL, bg_obj.buffer_lerp, NULL);
|
||||
ScrollSurface(bg_obj.buffer_lerp, 0, lerp(0, -bg_obj.bscroll));
|
||||
SDL_BlitSurface(bg_obj.buffer_lerp, &towerbuffer_rect, backBuffer, NULL);
|
||||
|
@ -2825,7 +2825,7 @@ void Graphics::menuoffrender(void)
|
|||
{
|
||||
SDL_Surface* tempbufferFlipped = FlipSurfaceVerticle(tempBuffer);
|
||||
//put the stored backbuffer in the backbuffer.
|
||||
SDL_FillRect(backBuffer, NULL, 0x00000000);
|
||||
ClearSurface(backBuffer);
|
||||
BlitSurfaceStandard(tempbufferFlipped, NULL, backBuffer, NULL);
|
||||
SDL_FreeSurface(tempbufferFlipped);
|
||||
SDL_Rect offsetRect;
|
||||
|
@ -2847,7 +2847,7 @@ void Graphics::menuoffrender(void)
|
|||
SDL_Rect rect;
|
||||
setRect(rect, 0, 0, backBuffer->w, backBuffer->h);
|
||||
screenbuffer->UpdateScreen(backBuffer,&rect);
|
||||
FillRect(backBuffer, 0x000000);
|
||||
ClearSurface(backBuffer);
|
||||
}
|
||||
|
||||
void Graphics::drawhuetile( int x, int y, int t )
|
||||
|
@ -2981,7 +2981,7 @@ void Graphics::screenshake(void)
|
|||
screenbuffer->UpdateScreen( backBuffer, &shakeRect);
|
||||
}
|
||||
|
||||
FillRect(backBuffer, 0x000000 );
|
||||
ClearSurface(backBuffer);
|
||||
}
|
||||
|
||||
void Graphics::updatescreenshake(void)
|
||||
|
|
|
@ -2316,7 +2316,7 @@ static void mapmenuactionpress(void)
|
|||
|
||||
//Kill contents of offset render buffer, since we do that for some reason.
|
||||
//This fixes an apparent frame flicker.
|
||||
FillRect(graphics.tempBuffer, 0x000000);
|
||||
ClearSurface(graphics.tempBuffer);
|
||||
graphics.fademode = 2;
|
||||
music.fadeout();
|
||||
map.nexttowercolour();
|
||||
|
|
|
@ -1169,7 +1169,7 @@ static void menurender(void)
|
|||
void titlerender()
|
||||
{
|
||||
|
||||
FillRect(graphics.backBuffer, 0,0,graphics.backBuffer->w, graphics.backBuffer->h, 0x00000000 );
|
||||
ClearSurface(graphics.backBuffer);
|
||||
|
||||
if (!game.menustart)
|
||||
{
|
||||
|
@ -1220,7 +1220,7 @@ void titlerender()
|
|||
|
||||
void gamecompleterender(void)
|
||||
{
|
||||
FillRect(graphics.backBuffer, 0x000000);
|
||||
ClearSurface(graphics.backBuffer);
|
||||
|
||||
if(!game.colourblindmode) graphics.drawtowerbackground(graphics.titlebg);
|
||||
|
||||
|
@ -1366,7 +1366,7 @@ void gamecompleterender(void)
|
|||
|
||||
void gamecompleterender2(void)
|
||||
{
|
||||
FillRect(graphics.backBuffer, 0x000000);
|
||||
ClearSurface(graphics.backBuffer);
|
||||
|
||||
graphics.drawimage(10, 0, 0);
|
||||
|
||||
|
@ -1412,7 +1412,7 @@ void gamerender(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
FillRect(graphics.backBuffer,0x00000);
|
||||
ClearSurface(graphics.backBuffer);
|
||||
}
|
||||
graphics.drawtowermap();
|
||||
}
|
||||
|
@ -1424,7 +1424,7 @@ void gamerender(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
FillRect(graphics.backBuffer,0x00000);
|
||||
ClearSurface(graphics.backBuffer);
|
||||
}
|
||||
if (map.final_colormode)
|
||||
{
|
||||
|
@ -1712,7 +1712,7 @@ void gamerender(void)
|
|||
|
||||
void maprender(void)
|
||||
{
|
||||
FillRect(graphics.backBuffer, 0x000000);
|
||||
ClearSurface(graphics.backBuffer);
|
||||
|
||||
//draw screen alliteration
|
||||
//Roomname:
|
||||
|
@ -2469,7 +2469,7 @@ void maprender(void)
|
|||
|
||||
void teleporterrender(void)
|
||||
{
|
||||
FillRect(graphics.backBuffer, 0x000000);
|
||||
ClearSurface(graphics.backBuffer);
|
||||
int tempx;
|
||||
int tempy;
|
||||
//draw screen alliteration
|
||||
|
|
|
@ -287,7 +287,7 @@ void Screen::UpdateScreen(SDL_Surface* buffer, SDL_Rect* rect )
|
|||
}
|
||||
|
||||
|
||||
FillRect(m_screen, 0x000);
|
||||
ClearSurface(m_screen);
|
||||
BlitSurfaceStandard(buffer,NULL,m_screen,rect);
|
||||
|
||||
if(badSignalEffect)
|
||||
|
@ -318,7 +318,7 @@ void Screen::FlipScreen(void)
|
|||
);
|
||||
SDL_RenderPresent(m_renderer);
|
||||
SDL_RenderClear(m_renderer);
|
||||
SDL_FillRect(m_screen, NULL, 0x00000000);
|
||||
ClearSurface(m_screen);
|
||||
}
|
||||
|
||||
void Screen::toggleFullScreen(void)
|
||||
|
|
|
@ -2155,7 +2155,7 @@ void editorclass::generatecustomminimap(void)
|
|||
map.custommmysize=180-(map.custommmyoff*2);
|
||||
}
|
||||
|
||||
FillRect(graphics.images[12], graphics.getRGB(0,0,0));
|
||||
ClearSurface(graphics.images[12]);
|
||||
|
||||
int tm=0;
|
||||
int temp=0;
|
||||
|
@ -2429,7 +2429,7 @@ void editorrender(void)
|
|||
|
||||
//Draw grid
|
||||
|
||||
FillRect(graphics.backBuffer, 0, 0, 320,240, graphics.getRGB(0,0,0));
|
||||
ClearSurface(graphics.backBuffer);
|
||||
for(int j=0; j<30; j++)
|
||||
{
|
||||
for(int i=0; i<40; i++)
|
||||
|
@ -2893,7 +2893,7 @@ void editorrender(void)
|
|||
|
||||
//Draw ghosts (spooky!)
|
||||
if (game.ghostsenabled) {
|
||||
SDL_FillRect(graphics.ghostbuffer, NULL, SDL_MapRGBA(graphics.ghostbuffer->format, 0, 0, 0, 0));
|
||||
ClearSurface(graphics.ghostbuffer);
|
||||
for (int i = 0; i < (int)ed.ghosts.size(); i++) {
|
||||
if (i <= ed.currentghosts) { // We don't want all of them to show up at once :)
|
||||
if (ed.ghosts[i].rx != ed.levx || ed.ghosts[i].ry != ed.levy
|
||||
|
@ -3185,7 +3185,7 @@ void editorrender(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
FillRect(graphics.backBuffer, 0, 0, 320, 240, 0x00000000);
|
||||
ClearSurface(graphics.backBuffer);
|
||||
}
|
||||
|
||||
int tr = graphics.titlebg.r - (help.glow / 4) - int(fRandom() * 4);
|
||||
|
|
|
@ -476,7 +476,7 @@ static void inline fixedloop(void)
|
|||
|
||||
if (!game.blackout)
|
||||
{
|
||||
FillRect(graphics.backBuffer, 0x00000000);
|
||||
ClearSurface(graphics.backBuffer);
|
||||
graphics.bprint(5, 110, "Game paused", 196 - help.glow, 255 - help.glow, 196 - help.glow, true);
|
||||
graphics.bprint(5, 120, "[click to resume]", 196 - help.glow, 255 - help.glow, 196 - help.glow, true);
|
||||
graphics.bprint(5, 220, "Press M to mute in game", 164 - help.glow, 196 - help.glow, 164 - help.glow, true);
|
||||
|
|
|
@ -110,7 +110,7 @@ void preloaderrender(void)
|
|||
}else if (pre_transition <= -10) {
|
||||
//Switch to TITLEMODE (handled by preloaderrenderfixed)
|
||||
}else if (pre_transition < 5) {
|
||||
FillRect(graphics.backBuffer, 0, 0, 320,240, graphics.getBGR(0,0,0));
|
||||
ClearSurface(graphics.backBuffer);
|
||||
}else if (pre_transition < 20) {
|
||||
pre_temprecty = 0;
|
||||
pre_temprecth = 240;
|
||||
|
|
Loading…
Reference in a new issue