A better way of setting the fullscreen flag for windows on Nintendo DS
authorSam Lantinga <slouken@libsdl.org>
Sun, 06 Mar 2011 21:18:36 -0800
changeset 5428 cff5d3cd5777
parent 5427 d9b4fd6fcdc4
child 5429 76329ba1fa5c
A better way of setting the fullscreen flag for windows on Nintendo DS
Makefile.ds
src/video/SDL_video.c
src/video/nds/SDL_ndsvideo.c
src/video/nds/SDL_ndsvideo.h
src/video/nds/SDL_ndswindow.c
src/video/nds/SDL_ndswindow.h
--- a/Makefile.ds	Sun Mar 06 21:17:44 2011 -0800
+++ b/Makefile.ds	Sun Mar 06 21:18:36 2011 -0800
@@ -106,6 +106,7 @@
 			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,15 +144,9 @@
 			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)))
--- a/src/video/SDL_video.c	Sun Mar 06 21:17:44 2011 -0800
+++ b/src/video/SDL_video.c	Sun Mar 06 21:18:36 2011 -0800
@@ -1131,10 +1131,6 @@
 #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) {
             SDL_SetError("No OpenGL support in video driver");
--- a/src/video/nds/SDL_ndsvideo.c	Sun Mar 06 21:17:44 2011 -0800
+++ b/src/video/nds/SDL_ndsvideo.c	Sun Mar 06 21:18:36 2011 -0800
@@ -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 <stdio.h>
 #include <stdlib.h>
@@ -375,12 +370,13 @@
     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. */
--- a/src/video/nds/SDL_ndsvideo.h	Sun Mar 06 21:17:44 2011 -0800
+++ b/src/video/nds/SDL_ndsvideo.h	Sun Mar 06 21:18:36 2011 -0800
@@ -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. */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/nds/SDL_ndswindow.c	Sun Mar 06 21:18:36 2011 -0800
@@ -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: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/nds/SDL_ndswindow.h	Sun Mar 06 21:18:36 2011 -0800
@@ -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: */