uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 52e0f9b29ec6d06c61133d3fcbaa10a6bc4e2495
parent a11cbb458f69a5d03c5a51832cab1ca86b3ba7b4
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date:   Fri, 11 Jun 2021 09:56:14 +0100

Used GetRendererOutputSize to get screenshot size

Diffstat:
Msrc/uxnemu.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -88,7 +88,9 @@ void save_screenshot(void) { const Uint32 format = SDL_PIXELFORMAT_ARGB8888; - SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(0, (ppu.width + PAD * 2) * zoom, (ppu.height + PAD * 2) * zoom, 32, format); + int w, h; + SDL_GetRendererOutputSize(gRenderer, &w, &h); + SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 32, format); SDL_LockSurface(surface); SDL_RenderReadPixels(gRenderer, NULL, format, surface->pixels, surface->pitch); SDL_UnlockSurface(surface);