shithub: candycrisis

Download patch

ref: 02db2e7cc119355cdb4994cd588fd38411f3195b
parent: f3fbdbe6a9917607b29ee8673a549b6851651347
author: Iliyas Jorio <iliyas@jor.io>
date: Wed Feb 2 14:31:16 EST 2022

Better widescreen crop on gameover screen

--- a/src/SDLU.cpp
+++ b/src/SDLU.cpp
@@ -440,9 +440,7 @@
     SDL_UpdateTexture(g_windowTexture, NULL, g_frontSurface->pixels, g_frontSurface->pitch);
     SDL_RenderClear(g_renderer);
     
-    SDL_Rect crop {0,60,640,360};
-    
-    SDL_RenderCopy(g_renderer, g_windowTexture, widescreen ? &crop : NULL, NULL);
+    SDL_RenderCopy(g_renderer, g_windowTexture, widescreen ? &g_widescreenCrop : NULL, NULL);
     SDL_RenderPresent(g_renderer);
     
     s_fpsAccumulator++;
--- a/src/level.cpp
+++ b/src/level.cpp
@@ -588,6 +588,10 @@
 	QuickFadeOut(NULL);
 
 	DrawPICTInSurface( g_frontSurface, picGameOver );
+
+    SDL_Rect widescreenCropBackup = g_widescreenCrop;
+    g_widescreenCrop.y = 30;
+
     SDLU_Present();
 
 	QuickFadeIn( NULL );
@@ -598,6 +602,8 @@
 	}
 	while( !AnyKeyIsPressed( ) && !SDLU_Button() );
 	QuickFadeOut( NULL );
+
+    g_widescreenCrop = widescreenCropBackup;
 }
 
 void InitStage( void )
binary files a/src/main.cpp b/src/main.cpp differ
--- a/src/main.h
+++ b/src/main.h
@@ -244,6 +244,7 @@
 extern SDL_Window*   g_window;
 extern SDL_Texture*  g_windowTexture;
 extern SDL_Surface*  g_frontSurface;
+extern SDL_Rect      g_widescreenCrop;
 
 extern signed char nextA[2], nextB[2], nextM[2], nextG[2], colorA[2], colorB[2],
 	blobX[2], blobY[2], blobR[2], blobSpin[2], speed[2], role[2], halfway[2],