SDL: Simplify setting full screen mode with SDL1

This commit is contained in:
Cameron Cawley 2019-05-21 21:24:03 +01:00 committed by endrift
parent 3aae19a807
commit 84c010783c
5 changed files with 5 additions and 11 deletions

View File

@ -51,9 +51,9 @@ void mSDLGLCommonInit(struct mSDLRenderer* renderer) {
#else #else
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1); SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
#ifdef COLOR_16_BIT #ifdef COLOR_16_BIT
SDL_SetVideoMode(renderer->viewportWidth, renderer->viewportHeight, 16, SDL_OPENGL | SDL_RESIZABLE | (SDL_FULLSCREEN * renderer->fullscreen)); SDL_SetVideoMode(renderer->viewportWidth, renderer->viewportHeight, 16, SDL_OPENGL | SDL_RESIZABLE | (SDL_FULLSCREEN * renderer->player.fullscreen));
#else #else
SDL_SetVideoMode(renderer->viewportWidth, renderer->viewportHeight, 32, SDL_OPENGL | SDL_RESIZABLE | (SDL_FULLSCREEN * renderer->fullscreen)); SDL_SetVideoMode(renderer->viewportWidth, renderer->viewportHeight, 32, SDL_OPENGL | SDL_RESIZABLE | (SDL_FULLSCREEN * renderer->player.fullscreen));
#endif #endif
SDL_WM_SetCaption(projectName, ""); SDL_WM_SetCaption(projectName, "");
#endif #endif

View File

@ -131,12 +131,8 @@ int main(int argc, char** argv) {
renderer.viewportWidth = renderer.core->opts.width; renderer.viewportWidth = renderer.core->opts.width;
renderer.viewportHeight = renderer.core->opts.height; renderer.viewportHeight = renderer.core->opts.height;
#if SDL_VERSION_ATLEAST(2, 0, 0)
renderer.player.fullscreen = renderer.core->opts.fullscreen; renderer.player.fullscreen = renderer.core->opts.fullscreen;
renderer.player.windowUpdated = 0; renderer.player.windowUpdated = 0;
#else
renderer.fullscreen = renderer.core->opts.fullscreen;
#endif
renderer.lockAspectRatio = renderer.core->opts.lockAspectRatio; renderer.lockAspectRatio = renderer.core->opts.lockAspectRatio;
renderer.lockIntegerScaling = renderer.core->opts.lockIntegerScaling; renderer.lockIntegerScaling = renderer.core->opts.lockIntegerScaling;

View File

@ -54,8 +54,6 @@ struct mSDLRenderer {
SDL_Texture* sdlTex; SDL_Texture* sdlTex;
SDL_Renderer* sdlRenderer; SDL_Renderer* sdlRenderer;
SDL_GLContext* glCtx; SDL_GLContext* glCtx;
#else
bool fullscreen;
#endif #endif
unsigned width; unsigned width;

View File

@ -63,10 +63,10 @@ struct mSDLPlayer {
size_t playerId; size_t playerId;
struct mInputMap* bindings; struct mInputMap* bindings;
struct SDL_JoystickCombo* joystick; struct SDL_JoystickCombo* joystick;
int fullscreen;
int windowUpdated; int windowUpdated;
#if SDL_VERSION_ATLEAST(2, 0, 0) #if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_Window* window; SDL_Window* window;
int fullscreen;
struct mSDLRumble { struct mSDLRumble {
struct mRumble d; struct mRumble d;

View File

@ -22,9 +22,9 @@ void mSDLSWCreate(struct mSDLRenderer* renderer) {
bool mSDLSWInit(struct mSDLRenderer* renderer) { bool mSDLSWInit(struct mSDLRenderer* renderer) {
#ifdef COLOR_16_BIT #ifdef COLOR_16_BIT
SDL_SetVideoMode(renderer->viewportWidth, renderer->viewportHeight, 16, SDL_DOUBLEBUF | SDL_HWSURFACE | (SDL_FULLSCREEN * renderer->fullscreen)); SDL_SetVideoMode(renderer->viewportWidth, renderer->viewportHeight, 16, SDL_DOUBLEBUF | SDL_HWSURFACE | (SDL_FULLSCREEN * renderer->player.fullscreen));
#else #else
SDL_SetVideoMode(renderer->viewportWidth, renderer->viewportHeight, 32, SDL_DOUBLEBUF | SDL_HWSURFACE | (SDL_FULLSCREEN * renderer->fullscreen)); SDL_SetVideoMode(renderer->viewportWidth, renderer->viewportHeight, 32, SDL_DOUBLEBUF | SDL_HWSURFACE | (SDL_FULLSCREEN * renderer->player.fullscreen));
#endif #endif
SDL_WM_SetCaption(projectName, ""); SDL_WM_SetCaption(projectName, "");