From b07239f5805d207a199774f6d2e35027044f6b80 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 6 Mar 2011 21:18:36 -0800 Subject: [PATCH] A better way of setting the fullscreen flag for windows on Nintendo DS --- Makefile.ds | 11 +++-------- src/video/SDL_video.c | 4 ---- src/video/nds/SDL_ndsvideo.c | 10 +++------- src/video/nds/SDL_ndsvideo.h | 2 ++ src/video/nds/SDL_ndswindow.c | 34 ++++++++++++++++++++++++++++++++++ src/video/nds/SDL_ndswindow.h | 31 +++++++++++++++++++++++++++++++ 6 files changed, 73 insertions(+), 19 deletions(-) create mode 100644 src/video/nds/SDL_ndswindow.c create mode 100644 src/video/nds/SDL_ndswindow.h diff --git a/Makefile.ds b/Makefile.ds index 35d078a0d..6f9e91837 100644 --- a/Makefile.ds +++ b/Makefile.ds @@ -106,6 +106,7 @@ CFILES := \ power/nds/SDL_syspower.c \ render/SDL_render.c \ render/SDL_yuv_sw.c \ + render/nds/SDL_ndsrender.c \ render/software/SDL_blendfillrect.c \ render/software/SDL_blendline.c \ render/software/SDL_blendpoint.c \ @@ -143,16 +144,10 @@ CFILES := \ video/SDL_surface.c \ video/SDL_video.c \ video/nds/SDL_ndsevents.c \ - video/nds/SDL_ndsvideo.c + video/nds/SDL_ndsvideo.c \ + video/nds/SDL_ndswindow.c -ifeq ($(USE_HW_RENDERER),1) -# Ideally we should be able to not include the SW renderer at set -# SDL_NO_COMPAT. However that breaks the build. -CFILES += render/nds/SDL_ndsrender.c -else -endif - #CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) #SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) #BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 871f885af..88774b25b 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1130,10 +1130,6 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) /* Some platforms have OpenGL enabled by default */ #if (SDL_VIDEO_OPENGL && __MACOSX__) || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 flags |= SDL_WINDOW_OPENGL; -#endif -#ifdef __NDS__ - /* Always for Nintendo DS. */ - flags |= SDL_WINDOW_FULLSCREEN; #endif if (flags & SDL_WINDOW_OPENGL) { if (!_this->GL_CreateContext) { diff --git a/src/video/nds/SDL_ndsvideo.c b/src/video/nds/SDL_ndsvideo.c index efb19a0d3..85293c4a7 100644 --- a/src/video/nds/SDL_ndsvideo.c +++ b/src/video/nds/SDL_ndsvideo.c @@ -21,12 +21,7 @@ */ #include "SDL_config.h" -/* SDL Nintendo DS video driver implementation - * based on dummy driver: - * Initial work by Ryan C. Gordon (icculus@icculus.org). A good portion - * of this was cut-and-pasted from Stephane Peter's work in the AAlib - * SDL video driver. Renamed to "DUMMY" by Sam Lantinga. - */ +/* SDL Nintendo DS video driver implementation */ #include #include @@ -375,12 +370,13 @@ static SDL_VideoDevice *NDS_CreateDevice(int devindex) device->VideoQuit = NDS_VideoQuit; device->GetDisplayModes = NDS_GetDisplayModes; device->SetDisplayMode = NDS_SetDisplayMode; - device->PumpEvents = NDS_PumpEvents; + device->CreateWindow = NDS_CreateWindow; #ifndef USE_HW_RENDERER device->CreateWindowFramebuffer = NDS_CreateWindowFramebuffer; device->UpdateWindowFramebuffer = NDS_UpdateWindowFramebuffer; device->DestroyWindowFramebuffer = NDS_DestroyWindowFramebuffer; #endif + device->PumpEvents = NDS_PumpEvents; device->free = NDS_DeleteDevice; /* Set the debug output. Use only for under an emulator. Will crash the DS. */ diff --git a/src/video/nds/SDL_ndsvideo.h b/src/video/nds/SDL_ndsvideo.h index b79b2addc..d6c623657 100644 --- a/src/video/nds/SDL_ndsvideo.h +++ b/src/video/nds/SDL_ndsvideo.h @@ -26,6 +26,8 @@ #include "../SDL_sysvideo.h" +#include "SDL_ndswindow.h" + #define SCREEN_GAP 92 /* line-equivalent gap between the 2 screens */ /* Per Window information. */ diff --git a/src/video/nds/SDL_ndswindow.c b/src/video/nds/SDL_ndswindow.c new file mode 100644 index 000000000..abf6f14a9 --- /dev/null +++ b/src/video/nds/SDL_ndswindow.c @@ -0,0 +1,34 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2011 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#include "SDL_ndsvideo.h" + + +int NDS_CreateWindow(_THIS, SDL_Window * window) +{ + /* Nintendo DS windows are always fullscreen */ + window->flags |= SDL_WINDOW_FULLSCREEN; + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/nds/SDL_ndswindow.h b/src/video/nds/SDL_ndswindow.h new file mode 100644 index 000000000..fc42f325b --- /dev/null +++ b/src/video/nds/SDL_ndswindow.h @@ -0,0 +1,31 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2011 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_ndswindow_h +#define _SDL_ndswindow_h + +extern int NDS_CreateWindow(_THIS, SDL_Window * window); + +#endif /* _SDL_ndswindow_h */ + +/* vi: set ts=4 sw=4 expandtab: */