Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
A better way of setting the fullscreen flag for windows on Nintendo DS
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Mar 7, 2011
1 parent 14498e1 commit b07239f
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 19 deletions.
11 changes: 3 additions & 8 deletions Makefile.ds
Expand Up @@ -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 \
Expand Down Expand Up @@ -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)/*.*)))
Expand Down
4 changes: 0 additions & 4 deletions src/video/SDL_video.c
Expand Up @@ -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) {
Expand Down
10 changes: 3 additions & 7 deletions src/video/nds/SDL_ndsvideo.c
Expand Up @@ -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>
Expand Down Expand Up @@ -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. */
Expand Down
2 changes: 2 additions & 0 deletions src/video/nds/SDL_ndsvideo.h
Expand Up @@ -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. */
Expand Down
34 changes: 34 additions & 0 deletions 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: */
31 changes: 31 additions & 0 deletions 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: */

0 comments on commit b07239f

Please sign in to comment.