all repos — mgba @ 7132c873e33d848f523a8a024c2959b451f4ead8

mGBA Game Boy Advance Emulator

Make viewport size not-hardcoded
Jeffrey Pfau jeffrey@endrift.com
Thu, 31 Oct 2013 22:01:20 -0700
commit

7132c873e33d848f523a8a024c2959b451f4ead8

parent

a8921116dc40e4812682da3b214395d557800fcf

1 files changed, 8 insertions(+), 3 deletions(-)

jump to
M src/platform/sdl/gl-main.csrc/platform/sdl/gl-main.c

@@ -23,6 +23,8 @@ struct GBAVideoSoftwareRenderer d;

struct GBASDLAudio audio; struct GBASDLEvents events; + int viewportWidth; + int viewportHeight; GLuint tex; };

@@ -59,6 +61,9 @@

struct GBAThread context; struct GLSoftwareRenderer renderer; GBAVideoSoftwareRendererCreate(&renderer.d); + + renderer.viewportWidth = 240; + renderer.viewportHeight = 160; if (!_GBASDLInit(&renderer)) { return 1;

@@ -101,9 +106,9 @@ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);

SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); #ifdef COLOR_16_BIT - SDL_SetVideoMode(240, 160, 16, SDL_OPENGL); + SDL_SetVideoMode(renderer->viewportWidth, renderer->viewportHeight, 16, SDL_OPENGL); #else - SDL_SetVideoMode(240, 160, 32, SDL_OPENGL); + SDL_SetVideoMode(renderer->viewportWidth, renderer->viewportHeight, 32, SDL_OPENGL); #endif renderer->d.outputBuffer = malloc(256 * 256 * 4);

@@ -118,7 +123,7 @@ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); #endif - glViewport(0, 0, 240, 160); + glViewport(0, 0, renderer->viewportWidth, renderer->viewportHeight); return 1; }