src/core/windows/SDL_directx.h
author Ryan C. Gordon <icculus@icculus.org>
Tue, 26 May 2015 21:19:23 -0400
changeset 9649 d7762e30ba24
parent 9619 b94b6d0bff0f
child 9998 f67cf37e9cd4
permissions -rw-r--r--
Stack hint should look for 0, not -1, and not care about environment variables.
slouken@8616
     1
/*
slouken@8616
     2
  Simple DirectMedia Layer
slouken@9619
     3
  Copyright (C) 1997-2015 Sam Lantinga <slouken@libsdl.org>
slouken@8616
     4
slouken@8616
     5
  This software is provided 'as-is', without any express or implied
slouken@8616
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@8616
     7
  arising from the use of this software.
slouken@8616
     8
slouken@8616
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@8616
    10
  including commercial applications, and to alter it and redistribute it
slouken@8616
    11
  freely, subject to the following restrictions:
slouken@8616
    12
slouken@8616
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@8616
    14
     claim that you wrote the original software. If you use this software
slouken@8616
    15
     in a product, an acknowledgment in the product documentation would be
slouken@8616
    16
     appreciated but is not required.
slouken@8616
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@8616
    18
     misrepresented as being the original software.
slouken@8616
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@8616
    20
*/
slouken@8972
    21
#include "../../SDL_internal.h"
slouken@1274
    22
slouken@8972
    23
#ifndef _SDL_directx_h
slouken@8972
    24
#define _SDL_directx_h
slouken@1274
    25
icculus@5587
    26
/* Include all of the DirectX 8.0 headers and adds any necessary tweaks */
slouken@1274
    27
slouken@8972
    28
#include "SDL_windows.h"
slouken@1274
    29
#include <mmsystem.h>
slouken@1274
    30
#ifndef WIN32
slouken@1274
    31
#define WIN32
slouken@1274
    32
#endif
slouken@1274
    33
#undef  WINNT
slouken@1274
    34
slouken@1274
    35
/* Far pointers don't exist in 32-bit code */
slouken@1274
    36
#ifndef FAR
slouken@1274
    37
#define FAR
slouken@1274
    38
#endif
slouken@1274
    39
slouken@1274
    40
/* Error codes not yet included in Win32 API header files */
slouken@1274
    41
#ifndef MAKE_HRESULT
slouken@1274
    42
#define MAKE_HRESULT(sev,fac,code) \
slouken@7191
    43
    ((HRESULT)(((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))))
slouken@1274
    44
#endif
slouken@1274
    45
slouken@1274
    46
#ifndef S_OK
slouken@7191
    47
#define S_OK        (HRESULT)0x00000000L
slouken@1274
    48
#endif
slouken@1274
    49
slouken@1274
    50
#ifndef SUCCEEDED
slouken@7191
    51
#define SUCCEEDED(x)    ((HRESULT)(x) >= 0)
slouken@1274
    52
#endif
slouken@1274
    53
#ifndef FAILED
slouken@7191
    54
#define FAILED(x)   ((HRESULT)(x)<0)
slouken@1274
    55
#endif
slouken@1274
    56
slouken@1274
    57
#ifndef E_FAIL
slouken@7191
    58
#define E_FAIL      (HRESULT)0x80000008L
slouken@1274
    59
#endif
slouken@1274
    60
#ifndef E_NOINTERFACE
slouken@7191
    61
#define E_NOINTERFACE   (HRESULT)0x80004002L
slouken@1274
    62
#endif
slouken@1274
    63
#ifndef E_OUTOFMEMORY
slouken@7191
    64
#define E_OUTOFMEMORY   (HRESULT)0x8007000EL
slouken@1274
    65
#endif
slouken@1274
    66
#ifndef E_INVALIDARG
slouken@7191
    67
#define E_INVALIDARG    (HRESULT)0x80070057L
slouken@1274
    68
#endif
slouken@1274
    69
#ifndef E_NOTIMPL
slouken@7191
    70
#define E_NOTIMPL   (HRESULT)0x80004001L
slouken@1274
    71
#endif
slouken@1274
    72
#ifndef REGDB_E_CLASSNOTREG
slouken@7191
    73
#define REGDB_E_CLASSNOTREG (HRESULT)0x80040154L
slouken@1274
    74
#endif
slouken@1274
    75
slouken@1274
    76
/* Severity codes */
slouken@1274
    77
#ifndef SEVERITY_ERROR
slouken@7191
    78
#define SEVERITY_ERROR  1
slouken@1274
    79
#endif
slouken@1274
    80
slouken@1274
    81
/* Error facility codes */
slouken@1274
    82
#ifndef FACILITY_WIN32
slouken@7191
    83
#define FACILITY_WIN32  7
slouken@1274
    84
#endif
slouken@1274
    85
slouken@1274
    86
#ifndef FIELD_OFFSET
slouken@1274
    87
#define FIELD_OFFSET(type, field)    ((LONG)&(((type *)0)->field))
slouken@1274
    88
#endif
slouken@1274
    89
slouken@1274
    90
/* DirectX headers (if it isn't included, I haven't tested it yet)
slouken@1274
    91
 */
slouken@1274
    92
/* We need these defines to mark what version of DirectX API we use */
slouken@1274
    93
#define DIRECTDRAW_VERSION  0x0700
icculus@5587
    94
#define DIRECTSOUND_VERSION 0x0800
slouken@8972
    95
#define DIRECTINPUT_VERSION 0x0800 /* Need version 7 for force feedback. Need version 8 so IDirectInput8_EnumDevices doesn't leak like a sieve... */
slouken@1274
    96
slouken@8972
    97
#ifdef HAVE_DDRAW_H
slouken@1274
    98
#include <ddraw.h>
slouken@8972
    99
#endif
slouken@8972
   100
#ifdef HAVE_DSOUND_H
slouken@1274
   101
#include <dsound.h>
slouken@8972
   102
#endif
slouken@8972
   103
#ifdef HAVE_DINPUT_H
slouken@1274
   104
#include <dinput.h>
slouken@8972
   105
#else
slouken@8972
   106
typedef struct { int unused; } DIDEVICEINSTANCE;
slouken@8972
   107
#endif
slouken@1274
   108
slouken@8972
   109
#endif /* _SDL_directx_h */
slouken@8616
   110
slouken@1895
   111
/* vi: set ts=4 sw=4 expandtab: */