From 8b0a7091f58ee0b5ff68af9e4b14afc0ea6d6fe8 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 2 Dec 2017 11:20:03 +0100 Subject: Added option for Fullscreen and various screen scalling (from x1 to x4, default to x2) --- src/main.c | 25 +++++++++++++++++++++++++ src/sdl/graphics.c | 40 +++++++++++++++++++++------------------- src/sdl/graphics.h | 3 +++ src/text.c | 2 +- 4 files changed, 50 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index 54f61e2..2e9fffc 100644 --- a/src/main.c +++ b/src/main.c @@ -38,6 +38,31 @@ int main(int argc, char **argv) sdmcInit(); osSetSpeedupEnable(false); #endif + #ifdef _SDL + #ifdef PANDORA + wantFullscreen = 1; + #else + wantFullscreen = 0; + #endif + screenScale = 2; + // get command line arguments + for (int i=1; iformat, c.r, c.g, c.b)); } } @@ -149,7 +151,7 @@ PHL_Surface PHL_LoadBMP(int index) void PHL_DrawRect(int x, int y, int w, int h, SDL_Color col) { - SDL_Rect rect = {x, y, w, h}; + SDL_Rect rect = {x*screenScale/2, y*screenScale/2, w*screenScale/2, h*screenScale/2}; SDL_FillRect(drawbuffer, &rect, SDL_MapRGB(drawbuffer->format, col.r, col.g, col.b)); } @@ -166,8 +168,8 @@ void PHL_DrawSurface(double x, double y, PHL_Surface surface) } SDL_Rect offset; - offset.x = x; - offset.y = y; + offset.x = x*screenScale/2; + offset.y = y*screenScale/2; SDL_BlitSurface(surface, NULL, drawbuffer, &offset); } @@ -176,20 +178,20 @@ void PHL_DrawSurfacePart(double x, double y, int cropx, int cropy, int cropw, in if (quakeTimer > 0) { int val = quakeTimer % 4; if (val == 0) { - y -= 1; + y -= (screenScale==1)?2:1; }else if (val == 2) { - y += 1; + y += (screenScale==1)?2:1; } } SDL_Rect crop, offset; - crop.x = cropx; - crop.y = cropy; - crop.w = cropw; - crop.h = croph; + crop.x = cropx*screenScale/2; + crop.y = cropy*screenScale/2; + crop.w = cropw*screenScale/2; + crop.h = croph*screenScale/2; - offset.x = x; - offset.y = y; + offset.x = x*screenScale/2; + offset.y = y*screenScale/2; SDL_BlitSurface(surface, &crop, drawbuffer, &offset); } @@ -203,7 +205,7 @@ void PHL_UpdateBackground(PHL_Background back, PHL_Background fore) PHL_SetDrawbuffer(backbuffer); int xx, yy; - + for (yy = 0; yy < 12; yy++) { for (xx = 0; xx < 16; xx++) diff --git a/src/sdl/graphics.h b/src/sdl/graphics.h index 3635294..459927d 100644 --- a/src/sdl/graphics.h +++ b/src/sdl/graphics.h @@ -27,6 +27,9 @@ typedef struct { */ extern PHL_Surface screen; +extern int wantFullscreen; +extern int screenScale; + SDL_Color PHL_NewRGB(uint8_t r, uint8_t g, uint8_t b); /* { diff --git a/src/text.c b/src/text.c index acfa375..51cf3d2 100644 --- a/src/text.c +++ b/src/text.c @@ -89,7 +89,7 @@ void loadText() //Load saving message loadMessage(saving, f); - printf("\n%d", saving->length); + //printf("\n%d", saving->length); //Load save error message int i; -- cgit v1.2.3