Added platform specific call: SDL_RenderGetD3DDevice()

This commit is contained in:
Sam Lantinga 2013-09-28 14:07:05 -07:00
parent 9f390e7967
commit 803965bcc2
2 changed files with 19 additions and 4 deletions

View File

@ -29,11 +29,9 @@
#define _SDL_system_h #define _SDL_system_h
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#if defined(__IPHONEOS__) && __IPHONEOS__
#include "SDL_video.h"
#include "SDL_keyboard.h" #include "SDL_keyboard.h"
#endif #include "SDL_render.h"
#include "SDL_video.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
@ -51,6 +49,10 @@ extern "C" {
*/ */
extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex ); extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex );
/* Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer. */
typedef struct IDirect3DDevice9 IDirect3DDevice9;
extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3DDevice(SDL_Renderer * renderer);
#endif /* __WIN32__ */ #endif /* __WIN32__ */

View File

@ -1875,6 +1875,19 @@ D3D_DestroyRenderer(SDL_Renderer * renderer)
SDL_free(renderer); SDL_free(renderer);
} }
IDirect3DDevice9 *
SDL_RenderGetD3DDevice(SDL_Renderer * renderer)
{
D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
// Make sure that this is a D3D renderer
if (renderer->DestroyRenderer != D3D_DestroyRenderer) {
SDL_SetError("Renderer is not a D3D renderer");
return NULL;
}
return data->device;
}
#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */ #endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */