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

Commit

Permalink
Browse files Browse the repository at this point in the history
Started framework for Windows video driver
  • Loading branch information
slouken committed Jun 26, 2006
1 parent 5e29ea7 commit 97aaf96
Show file tree
Hide file tree
Showing 20 changed files with 499 additions and 70 deletions.
22 changes: 4 additions & 18 deletions configure.in
Expand Up @@ -1861,9 +1861,8 @@ AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[de
fi

if test x$enable_video = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
have_video=yes
fi
}
Expand All @@ -1875,18 +1874,8 @@ CheckDIRECTX()
AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
, enable_directx=yes)
if test x$enable_directx = xyes; then
have_directx=no
AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
AC_CHECK_HEADER(dsound.h, have_dsound=yes)
AC_CHECK_HEADER(dinput.h, use_dinput=yes)
if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
have_directx=yes
fi
if test x$enable_video = xyes -a x$have_directx = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
have_video=yes
fi
fi
}

Expand Down Expand Up @@ -2311,15 +2300,15 @@ case "$host" in
if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
if test x$have_directx = xyes; then
if test x$have_dsound = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
fi
have_audio=yes
fi
# Set up files for the joystick library
if test x$enable_joystick = xyes; then
if test x$have_directx = xyes; then
if test x$have_dinput = xyes; then
AC_DEFINE(SDL_JOYSTICK_DINPUT)
SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_dxjoystick.c"
else
Expand Down Expand Up @@ -2357,9 +2346,6 @@ case "$host" in
fi
# Set up the system libraries we need
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm"
if test x$have_directx = xyes; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid"
fi
# The Win32 platform requires special setup
SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
Expand Down
6 changes: 4 additions & 2 deletions include/SDL_compat.h
Expand Up @@ -26,7 +26,7 @@
#define _SDL_compat_h

#include "SDL_video.h"
#include "SDL_syswm.h"
#include "SDL_version.h"

#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
Expand Down Expand Up @@ -117,6 +117,8 @@ typedef enum
SDL_GRAB_ON = 1
} SDL_GrabMode;

struct SDL_SysWMinfo;

#define SDL_AllocSurface SDL_CreateRGBSurface

extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void);
Expand Down Expand Up @@ -151,7 +153,7 @@ extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface, int flags,
extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface * surface,
const SDL_Color * colors,
int firstcolor, int ncolors);
extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo * info);
extern DECLSPEC int SDLCALL SDL_GetWMInfo(struct SDL_SysWMinfo * info);
extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
Expand Down
3 changes: 1 addition & 2 deletions include/SDL_config.h.in
Expand Up @@ -253,7 +253,6 @@
#undef SDL_VIDEO_DRIVER_BWINDOW
#undef SDL_VIDEO_DRIVER_CYBERGRAPHICS
#undef SDL_VIDEO_DRIVER_DC
#undef SDL_VIDEO_DRIVER_DDRAW
#undef SDL_VIDEO_DRIVER_DGA
#undef SDL_VIDEO_DRIVER_DIRECTFB
#undef SDL_VIDEO_DRIVER_DRAWSPROCKET
Expand All @@ -276,7 +275,7 @@
#undef SDL_VIDEO_DRIVER_SVGALIB
#undef SDL_VIDEO_DRIVER_TOOLBOX
#undef SDL_VIDEO_DRIVER_VGL
#undef SDL_VIDEO_DRIVER_WINDIB
#undef SDL_VIDEO_DRIVER_WIN32
#undef SDL_VIDEO_DRIVER_WSCONS
#undef SDL_VIDEO_DRIVER_X11
#undef SDL_VIDEO_DRIVER_X11_DGAMOUSE
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_syswm.h
Expand Up @@ -129,7 +129,7 @@ struct SDL_SysWMinfo
GR_WINDOW_ID window; /* The display window */
};

#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
#elif defined(SDL_VIDEO_DRIVER_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

Expand Down
5 changes: 5 additions & 0 deletions src/SDL.c
Expand Up @@ -348,6 +348,11 @@ _DllMainCRTStartup(HANDLE hModule,
}
#endif /* building DLL with Watcom C */

void SDL_SetModuleHandle(void *hInst)
{
/* FIXME: Do we still need this? */
}

#endif /* OS/2 elif __WIN32__ */

/* vi: set ts=4 sw=4 expandtab: */
1 change: 1 addition & 0 deletions src/SDL_compat.c
Expand Up @@ -24,6 +24,7 @@
/* This file contains functions for backwards compatibility with SDL 1.2 */

#include "SDL.h"
#include "SDL_syswm.h"

#include "video/SDL_pixels_c.h"

Expand Down
31 changes: 2 additions & 29 deletions src/video/SDL_sysvideo.h
Expand Up @@ -29,14 +29,6 @@
#include "SDL_syswm.h"
#undef SDL_PROTOTYPES_ONLY

/* This file prototypes the video driver implementation.
This is designed to be easily converted to C++ in the future.
*/

#if SDL_VIDEO_OPENGL
#include "SDL_opengl.h"
#endif /* SDL_VIDEO_OPENGL */

/* The SDL video driver */

typedef struct SDL_Window SDL_Window;
Expand Down Expand Up @@ -256,21 +248,6 @@ struct SDL_VideoDevice
/* Swap the current buffers in double buffer mode. */
void (*GL_SwapBuffers) (_THIS);

/* OpenGL functions for glSDL */
#if SDL_VIDEO_OPENGL
#if !defined(__WIN32__)
#define WINAPI
#endif
#define SDL_PROC(ret,func,params) ret (WINAPI *func) params;
#include "SDL_glfuncs.h"
#undef SDL_PROC

/* Texture id */
GLuint texture;

int is_32bit;
#endif

/* Determine whether the mouse should be in relative mode or not.
This function is called when the input grab state or cursor
visibility state changes.
Expand Down Expand Up @@ -330,7 +307,6 @@ struct SDL_VideoDevice
/* The function used to dispose of this structure */
void (*free) (_THIS);
};
#undef _THIS

typedef struct VideoBootStrap
{
Expand Down Expand Up @@ -382,11 +358,8 @@ extern VideoBootStrap SVGALIB_bootstrap;
#if SDL_VIDEO_DRIVER_GAPI
extern VideoBootStrap GAPI_bootstrap;
#endif
#if SDL_VIDEO_DRIVER_WINDIB
extern VideoBootStrap WINDIB_bootstrap;
#endif
#if SDL_VIDEO_DRIVER_DDRAW
extern VideoBootStrap DIRECTX_bootstrap;
#if SDL_VIDEO_DRIVER_WIN32
extern VideoBootStrap WIN32_bootstrap;
#endif
#if SDL_VIDEO_DRIVER_BWINDOW
extern VideoBootStrap BWINDOW_bootstrap;
Expand Down
7 changes: 2 additions & 5 deletions src/video/SDL_video.c
Expand Up @@ -75,11 +75,8 @@ static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_GAPI
&GAPI_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_WINDIB
&WINDIB_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_DDRAW
&DIRECTX_bootstrap,
#if SDL_VIDEO_DRIVER_WIN32
&WIN32_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_BWINDOW
&BWINDOW_bootstrap,
Expand Down
4 changes: 2 additions & 2 deletions src/video/dummy/SDL_nullvideo.h
Expand Up @@ -34,9 +34,9 @@

struct SDL_PrivateVideoData
{
int w, h;
void *buffer;
int unused;
};

#endif /* _SDL_nullvideo_h */

/* vi: set ts=4 sw=4 expandtab: */
31 changes: 31 additions & 0 deletions src/video/win32/SDL_win32events.c
@@ -0,0 +1,31 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 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_win32video.h"

void
WIN32_PumpEvents(_THIS)
{
}

/* vi: set ts=4 sw=4 expandtab: */
33 changes: 33 additions & 0 deletions src/video/win32/SDL_win32events.h
@@ -0,0 +1,33 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 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_win32events_h
#define _SDL_win32events_h

#include "../SDL_sysvideo.h"

extern void WIN32_PumpEvents(_THIS);

#endif /* _SDL_win32events_h */

/* vi: set ts=4 sw=4 expandtab: */

0 comments on commit 97aaf96

Please sign in to comment.