libs/sqplus/DXSquirrel/DXSquirrel_DX.cpp

230 lines
12 KiB
C++
Raw Permalink Normal View History

2017-01-10 04:08:49 +00:00
#include "stdafx.h"
#include "sqplus.h"
#include "DXSquirrel_Binds.h"
//updates the message loop
_MEMBER_FUNCTION_IMPL(DX,Update)
{
StackHandler sa(v);
MSG msg;
ZeroMemory( &msg, sizeof(msg) );
while( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
{
if(msg.message == WM_QUIT)
{
return sa.Return(false);
}
TranslateMessage( &msg );
DispatchMessage( &msg );
}
return sa.Return(true);
}
//
_BEGIN_NAMESPACE(DX)
_MEMBER_FUNCTION(DX,Update,0,0)
_BEGIN_NAMESPACE_CONSTANTS(DX)
//D3DDEVTYPE
_CONSTANT(D3DDEVTYPE_HAL,OT_INTEGER,D3DDEVTYPE_HAL)
_CONSTANT(D3DDEVTYPE_REF,OT_INTEGER,D3DDEVTYPE_REF)
_CONSTANT(D3DDEVTYPE_SW,OT_INTEGER,D3DDEVTYPE_SW)
//SWAPEFFECT
_CONSTANT(D3DSWAPEFFECT_DISCARD,OT_INTEGER,D3DSWAPEFFECT_DISCARD)
_CONSTANT(D3DSWAPEFFECT_FLIP,OT_INTEGER,D3DSWAPEFFECT_FLIP)
_CONSTANT(D3DSWAPEFFECT_COPY,OT_INTEGER,D3DSWAPEFFECT_COPY)
//D3DCREATE
_CONSTANT(D3DCREATE_ADAPTERGROUP_DEVICE,OT_INTEGER,D3DCREATE_ADAPTERGROUP_DEVICE)
_CONSTANT(D3DCREATE_DISABLE_DRIVER_MANAGEMENT,OT_INTEGER,D3DCREATE_DISABLE_DRIVER_MANAGEMENT)
_CONSTANT(D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX,OT_INTEGER,D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX)
_CONSTANT(D3DCREATE_FPU_PRESERVE,OT_INTEGER,D3DCREATE_FPU_PRESERVE)
_CONSTANT(D3DCREATE_HARDWARE_VERTEXPROCESSING,OT_INTEGER,D3DCREATE_HARDWARE_VERTEXPROCESSING)
_CONSTANT(D3DCREATE_MIXED_VERTEXPROCESSING,OT_INTEGER,D3DCREATE_MIXED_VERTEXPROCESSING)
_CONSTANT(D3DCREATE_MULTITHREADED,OT_INTEGER,D3DCREATE_MULTITHREADED)
_CONSTANT(D3DCREATE_NOWINDOWCHANGES,OT_INTEGER,D3DCREATE_NOWINDOWCHANGES)
_CONSTANT(D3DCREATE_PUREDEVICE,OT_INTEGER,D3DCREATE_PUREDEVICE)
_CONSTANT(D3DCREATE_SOFTWARE_VERTEXPROCESSING,OT_INTEGER,D3DCREATE_SOFTWARE_VERTEXPROCESSING)
//D3DFMT
_CONSTANT(D3DFMT_UNKNOWN,OT_INTEGER,D3DFMT_UNKNOWN)
_CONSTANT(D3DFMT_R8G8B8,OT_INTEGER,D3DFMT_R8G8B8)
_CONSTANT(D3DFMT_A8R8G8B8,OT_INTEGER,D3DFMT_A8R8G8B8)
_CONSTANT(D3DFMT_X8R8G8B8,OT_INTEGER,D3DFMT_X8R8G8B8)
_CONSTANT(D3DFMT_R5G6B5,OT_INTEGER,D3DFMT_R5G6B5)
_CONSTANT(D3DFMT_X1R5G5B5,OT_INTEGER,D3DFMT_X1R5G5B5)
_CONSTANT(D3DFMT_A1R5G5B5,OT_INTEGER,D3DFMT_A1R5G5B5)
_CONSTANT(D3DFMT_A4R4G4B4,OT_INTEGER,D3DFMT_A4R4G4B4)
_CONSTANT(D3DFMT_R3G3B2,OT_INTEGER,D3DFMT_R3G3B2)
_CONSTANT(D3DFMT_A8,OT_INTEGER,D3DFMT_A8)
_CONSTANT(D3DFMT_A8R3G3B2,OT_INTEGER,D3DFMT_A8R3G3B2)
_CONSTANT(D3DFMT_X4R4G4B4,OT_INTEGER,D3DFMT_X4R4G4B4)
_CONSTANT(D3DFMT_A2B10G10R10,OT_INTEGER,D3DFMT_A2B10G10R10)
_CONSTANT(D3DFMT_A8B8G8R8,OT_INTEGER,D3DFMT_A8B8G8R8)
_CONSTANT(D3DFMT_X8B8G8R8,OT_INTEGER,D3DFMT_X8B8G8R8)
_CONSTANT(D3DFMT_G16R16,OT_INTEGER,D3DFMT_G16R16)
_CONSTANT(D3DFMT_A2R10G10B10,OT_INTEGER,D3DFMT_A2R10G10B10)
_CONSTANT(D3DFMT_A16B16G16R16,OT_INTEGER,D3DFMT_A16B16G16R16)
_CONSTANT(D3DFMT_A8P8,OT_INTEGER,D3DFMT_A8P8)
_CONSTANT(D3DFMT_P8,OT_INTEGER,D3DFMT_P8)
_CONSTANT(D3DFMT_L8,OT_INTEGER,D3DFMT_L8)
_CONSTANT(D3DFMT_A8L8,OT_INTEGER,D3DFMT_A8L8)
_CONSTANT(D3DFMT_A4L4,OT_INTEGER,D3DFMT_A4L4)
_CONSTANT(D3DFMT_V8U8,OT_INTEGER,D3DFMT_V8U8)
_CONSTANT(D3DFMT_L6V5U5,OT_INTEGER,D3DFMT_L6V5U5)
_CONSTANT(D3DFMT_X8L8V8U8,OT_INTEGER,D3DFMT_X8L8V8U8)
_CONSTANT(D3DFMT_Q8W8V8U8,OT_INTEGER,D3DFMT_Q8W8V8U8)
_CONSTANT(D3DFMT_V16U16,OT_INTEGER,D3DFMT_V16U16)
_CONSTANT(D3DFMT_A2W10V10U10,OT_INTEGER,D3DFMT_A2W10V10U10)
_CONSTANT(D3DFMT_UYVY,OT_INTEGER,D3DFMT_UYVY)
_CONSTANT(D3DFMT_R8G8_B8G8,OT_INTEGER,D3DFMT_R8G8_B8G8)
_CONSTANT(D3DFMT_YUY2,OT_INTEGER,D3DFMT_YUY2)
_CONSTANT(D3DFMT_G8R8_G8B8,OT_INTEGER,D3DFMT_G8R8_G8B8)
_CONSTANT(D3DFMT_DXT1,OT_INTEGER,D3DFMT_DXT1)
_CONSTANT(D3DFMT_DXT2,OT_INTEGER,D3DFMT_DXT2)
_CONSTANT(D3DFMT_DXT3,OT_INTEGER,D3DFMT_DXT3)
_CONSTANT(D3DFMT_DXT4,OT_INTEGER,D3DFMT_DXT4)
_CONSTANT(D3DFMT_DXT5,OT_INTEGER,D3DFMT_DXT5)
_CONSTANT(D3DFMT_D16_LOCKABLE,OT_INTEGER,D3DFMT_D16_LOCKABLE)
_CONSTANT(D3DFMT_D32,OT_INTEGER,D3DFMT_D32)
_CONSTANT(D3DFMT_D15S1,OT_INTEGER,D3DFMT_D15S1)
_CONSTANT(D3DFMT_D24S8,OT_INTEGER,D3DFMT_D24S8)
_CONSTANT(D3DFMT_D24X8,OT_INTEGER,D3DFMT_D24X8)
_CONSTANT(D3DFMT_D24X4S4,OT_INTEGER,D3DFMT_D24X4S4)
_CONSTANT(D3DFMT_D16,OT_INTEGER,D3DFMT_D16)
_CONSTANT(D3DFMT_D32F_LOCKABLE,OT_INTEGER,D3DFMT_D32F_LOCKABLE)
_CONSTANT(D3DFMT_D24FS8,OT_INTEGER,D3DFMT_D24FS8)
_CONSTANT(D3DFMT_L16,OT_INTEGER,D3DFMT_L16)
_CONSTANT(D3DFMT_VERTEXDATA,OT_INTEGER,D3DFMT_VERTEXDATA)
_CONSTANT(D3DFMT_INDEX16,OT_INTEGER,D3DFMT_INDEX16)
_CONSTANT(D3DFMT_INDEX32,OT_INTEGER,D3DFMT_INDEX32)
_CONSTANT(D3DFMT_Q16W16V16U16,OT_INTEGER,D3DFMT_Q16W16V16U16)
_CONSTANT(D3DFMT_MULTI2_ARGB8,OT_INTEGER,D3DFMT_MULTI2_ARGB8)
_CONSTANT(D3DFMT_R16F,OT_INTEGER,D3DFMT_R16F)
_CONSTANT(D3DFMT_G16R16F,OT_INTEGER,D3DFMT_G16R16F)
_CONSTANT(D3DFMT_A16B16G16R16F,OT_INTEGER,D3DFMT_A16B16G16R16F)
_CONSTANT(D3DFMT_R32F,OT_INTEGER,D3DFMT_R32F)
_CONSTANT(D3DFMT_G32R32F,OT_INTEGER,D3DFMT_G32R32F)
_CONSTANT(D3DFMT_A32B32G32R32F,OT_INTEGER,D3DFMT_A32B32G32R32F)
_CONSTANT(D3DFMT_CxV8U8,OT_INTEGER,D3DFMT_CxV8U8)
//D3DCLEAR
_CONSTANT(D3DCLEAR_STENCIL,OT_INTEGER,D3DCLEAR_STENCIL)
_CONSTANT(D3DCLEAR_TARGET,OT_INTEGER,D3DCLEAR_TARGET)
_CONSTANT(D3DCLEAR_ZBUFFER,OT_INTEGER,D3DCLEAR_ZBUFFER)
//D3DTS
_CONSTANT(D3DTS_WORLD,OT_INTEGER,D3DTS_WORLD)
_CONSTANT(D3DTS_VIEW,OT_INTEGER,D3DTS_VIEW)
_CONSTANT(D3DTS_PROJECTION,OT_INTEGER,D3DTS_PROJECTION)
_CONSTANT(D3DTS_TEXTURE0,OT_INTEGER,D3DTS_TEXTURE0)
_CONSTANT(D3DTS_TEXTURE1,OT_INTEGER,D3DTS_TEXTURE1)
_CONSTANT(D3DTS_TEXTURE2,OT_INTEGER,D3DTS_TEXTURE2)
_CONSTANT(D3DTS_TEXTURE3,OT_INTEGER,D3DTS_TEXTURE3)
_CONSTANT(D3DTS_TEXTURE4,OT_INTEGER,D3DTS_TEXTURE4)
_CONSTANT(D3DTS_TEXTURE5,OT_INTEGER,D3DTS_TEXTURE5)
_CONSTANT(D3DTS_TEXTURE6,OT_INTEGER,D3DTS_TEXTURE6)
_CONSTANT(D3DTS_TEXTURE7,OT_INTEGER,D3DTS_TEXTURE7)
//
_CONSTANT(D3DX_PI,OT_INTEGER,D3DX_PI)
//RS
_CONSTANT(D3DRS_ZENABLE,OT_INTEGER,D3DRS_ZENABLE)
_CONSTANT(D3DRS_FILLMODE,OT_INTEGER,D3DRS_FILLMODE)
_CONSTANT(D3DRS_SHADEMODE,OT_INTEGER,D3DRS_SHADEMODE)
_CONSTANT(D3DRS_ZWRITEENABLE,OT_INTEGER,D3DRS_ZWRITEENABLE)
_CONSTANT(D3DRS_ALPHATESTENABLE,OT_INTEGER,D3DRS_ALPHATESTENABLE)
_CONSTANT(D3DRS_LASTPIXEL,OT_INTEGER,D3DRS_LASTPIXEL)
_CONSTANT(D3DRS_SRCBLEND,OT_INTEGER,D3DRS_SRCBLEND)
_CONSTANT(D3DRS_DESTBLEND,OT_INTEGER,D3DRS_DESTBLEND)
_CONSTANT(D3DRS_CULLMODE,OT_INTEGER,D3DRS_CULLMODE)
_CONSTANT(D3DRS_ZFUNC,OT_INTEGER,D3DRS_ZFUNC)
_CONSTANT(D3DRS_ALPHAREF,OT_INTEGER,D3DRS_ALPHAREF)
_CONSTANT(D3DRS_ALPHAFUNC,OT_INTEGER,D3DRS_ALPHAFUNC)
_CONSTANT(D3DRS_DITHERENABLE,OT_INTEGER,D3DRS_DITHERENABLE)
_CONSTANT(D3DRS_ALPHABLENDENABLE,OT_INTEGER,D3DRS_ALPHABLENDENABLE)
_CONSTANT(D3DRS_FOGENABLE,OT_INTEGER,D3DRS_FOGENABLE)
_CONSTANT(D3DRS_SPECULARENABLE,OT_INTEGER,D3DRS_SPECULARENABLE)
_CONSTANT(D3DRS_FOGCOLOR,OT_INTEGER,D3DRS_FOGCOLOR)
_CONSTANT(D3DRS_FOGTABLEMODE,OT_INTEGER,D3DRS_FOGTABLEMODE)
_CONSTANT(D3DRS_FOGSTART,OT_INTEGER,D3DRS_FOGSTART)
_CONSTANT(D3DRS_FOGEND,OT_INTEGER,D3DRS_FOGEND)
_CONSTANT(D3DRS_FOGDENSITY,OT_INTEGER,D3DRS_FOGDENSITY)
_CONSTANT(D3DRS_RANGEFOGENABLE,OT_INTEGER,D3DRS_RANGEFOGENABLE)
_CONSTANT(D3DRS_STENCILENABLE,OT_INTEGER,D3DRS_STENCILENABLE)
_CONSTANT(D3DRS_STENCILFAIL,OT_INTEGER,D3DRS_STENCILFAIL)
_CONSTANT(D3DRS_STENCILZFAIL,OT_INTEGER,D3DRS_STENCILZFAIL)
_CONSTANT(D3DRS_STENCILPASS,OT_INTEGER,D3DRS_STENCILPASS)
_CONSTANT(D3DRS_STENCILFUNC,OT_INTEGER,D3DRS_STENCILFUNC)
_CONSTANT(D3DRS_STENCILREF,OT_INTEGER,D3DRS_STENCILREF)
_CONSTANT(D3DRS_STENCILMASK,OT_INTEGER,D3DRS_STENCILMASK)
_CONSTANT(D3DRS_STENCILWRITEMASK,OT_INTEGER,D3DRS_STENCILWRITEMASK)
_CONSTANT(D3DRS_TEXTUREFACTOR,OT_INTEGER,D3DRS_TEXTUREFACTOR)
_CONSTANT(D3DRS_WRAP0,OT_INTEGER,D3DRS_WRAP0)
_CONSTANT(D3DRS_WRAP1,OT_INTEGER,D3DRS_WRAP1)
_CONSTANT(D3DRS_WRAP2,OT_INTEGER,D3DRS_WRAP2)
_CONSTANT(D3DRS_WRAP3,OT_INTEGER,D3DRS_WRAP3)
_CONSTANT(D3DRS_WRAP4,OT_INTEGER,D3DRS_WRAP4)
_CONSTANT(D3DRS_WRAP5,OT_INTEGER,D3DRS_WRAP5)
_CONSTANT(D3DRS_WRAP6,OT_INTEGER,D3DRS_WRAP6)
_CONSTANT(D3DRS_WRAP7,OT_INTEGER,D3DRS_WRAP7)
_CONSTANT(D3DRS_CLIPPING,OT_INTEGER,D3DRS_CLIPPING)
_CONSTANT(D3DRS_LIGHTING,OT_INTEGER,D3DRS_LIGHTING)
_CONSTANT(D3DRS_AMBIENT,OT_INTEGER,D3DRS_AMBIENT)
_CONSTANT(D3DRS_FOGVERTEXMODE,OT_INTEGER,D3DRS_FOGVERTEXMODE)
_CONSTANT(D3DRS_COLORVERTEX,OT_INTEGER,D3DRS_COLORVERTEX)
_CONSTANT(D3DRS_LOCALVIEWER,OT_INTEGER,D3DRS_LOCALVIEWER)
_CONSTANT(D3DRS_NORMALIZENORMALS,OT_INTEGER,D3DRS_NORMALIZENORMALS)
_CONSTANT(D3DRS_DIFFUSEMATERIALSOURCE,OT_INTEGER,D3DRS_DIFFUSEMATERIALSOURCE)
_CONSTANT(D3DRS_SPECULARMATERIALSOURCE,OT_INTEGER,D3DRS_SPECULARMATERIALSOURCE)
_CONSTANT(D3DRS_AMBIENTMATERIALSOURCE,OT_INTEGER,D3DRS_AMBIENTMATERIALSOURCE)
_CONSTANT(D3DRS_EMISSIVEMATERIALSOURCE,OT_INTEGER,D3DRS_EMISSIVEMATERIALSOURCE)
_CONSTANT(D3DRS_VERTEXBLEND,OT_INTEGER,D3DRS_VERTEXBLEND)
_CONSTANT(D3DRS_CLIPPLANEENABLE,OT_INTEGER,D3DRS_CLIPPLANEENABLE)
_CONSTANT(D3DRS_POINTSIZE,OT_INTEGER,D3DRS_POINTSIZE)
_CONSTANT(D3DRS_POINTSIZE_MIN,OT_INTEGER,D3DRS_POINTSIZE_MIN)
_CONSTANT(D3DRS_POINTSPRITEENABLE,OT_INTEGER,D3DRS_POINTSPRITEENABLE)
_CONSTANT(D3DRS_POINTSCALEENABLE,OT_INTEGER,D3DRS_POINTSCALEENABLE)
_CONSTANT(D3DRS_POINTSCALE_A,OT_INTEGER,D3DRS_POINTSCALE_A)
_CONSTANT(D3DRS_POINTSCALE_B,OT_INTEGER,D3DRS_POINTSCALE_B)
_CONSTANT(D3DRS_POINTSCALE_C,OT_INTEGER,D3DRS_POINTSCALE_C)
_CONSTANT(D3DRS_MULTISAMPLEANTIALIAS,OT_INTEGER,D3DRS_MULTISAMPLEANTIALIAS)
_CONSTANT(D3DRS_MULTISAMPLEMASK,OT_INTEGER,D3DRS_MULTISAMPLEMASK)
_CONSTANT(D3DRS_PATCHEDGESTYLE,OT_INTEGER,D3DRS_PATCHEDGESTYLE)
_CONSTANT(D3DRS_DEBUGMONITORTOKEN,OT_INTEGER,D3DRS_DEBUGMONITORTOKEN)
_CONSTANT(D3DRS_POINTSIZE_MAX,OT_INTEGER,D3DRS_POINTSIZE_MAX)
_CONSTANT(D3DRS_INDEXEDVERTEXBLENDENABLE,OT_INTEGER,D3DRS_INDEXEDVERTEXBLENDENABLE)
_CONSTANT(D3DRS_COLORWRITEENABLE,OT_INTEGER,D3DRS_COLORWRITEENABLE)
_CONSTANT(D3DRS_TWEENFACTOR,OT_INTEGER,D3DRS_TWEENFACTOR)
_CONSTANT(D3DRS_BLENDOP,OT_INTEGER,D3DRS_BLENDOP)
_CONSTANT(D3DRS_POSITIONDEGREE,OT_INTEGER,D3DRS_POSITIONDEGREE)
_CONSTANT(D3DRS_NORMALDEGREE,OT_INTEGER,D3DRS_NORMALDEGREE)
_CONSTANT(D3DRS_SCISSORTESTENABLE,OT_INTEGER,D3DRS_SCISSORTESTENABLE)
_CONSTANT(D3DRS_SLOPESCALEDEPTHBIAS,OT_INTEGER,D3DRS_SLOPESCALEDEPTHBIAS)
_CONSTANT(D3DRS_ANTIALIASEDLINEENABLE,OT_INTEGER,D3DRS_ANTIALIASEDLINEENABLE)
_CONSTANT(D3DRS_MINTESSELLATIONLEVEL,OT_INTEGER,D3DRS_MINTESSELLATIONLEVEL)
_CONSTANT(D3DRS_MAXTESSELLATIONLEVEL,OT_INTEGER,D3DRS_MAXTESSELLATIONLEVEL)
_CONSTANT(D3DRS_ADAPTIVETESS_X,OT_INTEGER,D3DRS_ADAPTIVETESS_X)
_CONSTANT(D3DRS_ADAPTIVETESS_Y,OT_INTEGER,D3DRS_ADAPTIVETESS_Y)
_CONSTANT(D3DRS_ADAPTIVETESS_Z,OT_INTEGER,D3DRS_ADAPTIVETESS_Z)
_CONSTANT(D3DRS_ADAPTIVETESS_W,OT_INTEGER,D3DRS_ADAPTIVETESS_W)
_CONSTANT(D3DRS_ENABLEADAPTIVETESSELLATION,OT_INTEGER,D3DRS_ENABLEADAPTIVETESSELLATION)
_CONSTANT(D3DRS_TWOSIDEDSTENCILMODE,OT_INTEGER,D3DRS_TWOSIDEDSTENCILMODE)
_CONSTANT(D3DRS_CCW_STENCILFAIL,OT_INTEGER,D3DRS_CCW_STENCILFAIL)
_CONSTANT(D3DRS_CCW_STENCILZFAIL,OT_INTEGER,D3DRS_CCW_STENCILZFAIL)
_CONSTANT(D3DRS_CCW_STENCILPASS,OT_INTEGER,D3DRS_CCW_STENCILPASS)
_CONSTANT(D3DRS_CCW_STENCILFUNC,OT_INTEGER,D3DRS_CCW_STENCILFUNC)
_CONSTANT(D3DRS_COLORWRITEENABLE1,OT_INTEGER,D3DRS_COLORWRITEENABLE1)
_CONSTANT(D3DRS_COLORWRITEENABLE2,OT_INTEGER,D3DRS_COLORWRITEENABLE2)
_CONSTANT(D3DRS_COLORWRITEENABLE3,OT_INTEGER,D3DRS_COLORWRITEENABLE3)
_CONSTANT(D3DRS_BLENDFACTOR,OT_INTEGER,D3DRS_BLENDFACTOR)
_CONSTANT(D3DRS_SRGBWRITEENABLE,OT_INTEGER,D3DRS_SRGBWRITEENABLE)
_CONSTANT(D3DRS_DEPTHBIAS,OT_INTEGER,D3DRS_DEPTHBIAS)
_CONSTANT(D3DRS_WRAP8,OT_INTEGER,D3DRS_WRAP8)
_CONSTANT(D3DRS_WRAP9,OT_INTEGER,D3DRS_WRAP9)
_CONSTANT(D3DRS_WRAP10,OT_INTEGER,D3DRS_WRAP10)
_CONSTANT(D3DRS_WRAP11,OT_INTEGER,D3DRS_WRAP11)
_CONSTANT(D3DRS_WRAP12,OT_INTEGER,D3DRS_WRAP12)
_CONSTANT(D3DRS_WRAP13,OT_INTEGER,D3DRS_WRAP13)
_CONSTANT(D3DRS_WRAP14,OT_INTEGER,D3DRS_WRAP14)
_CONSTANT(D3DRS_WRAP15,OT_INTEGER,D3DRS_WRAP15)
_CONSTANT(D3DRS_SEPARATEALPHABLENDENABLE,OT_INTEGER,D3DRS_SEPARATEALPHABLENDENABLE)
_CONSTANT(D3DRS_SRCBLENDALPHA,OT_INTEGER,D3DRS_SRCBLENDALPHA)
_CONSTANT(D3DRS_DESTBLENDALPHA,OT_INTEGER,D3DRS_DESTBLENDALPHA)
_CONSTANT(D3DRS_BLENDOPALPHA,OT_INTEGER,D3DRS_BLENDOPALPHA)
_CONSTANT(D3DRS_FORCE_DWORD,OT_INTEGER,D3DRS_FORCE_DWORD)
_END_NAMESPACE(DX,NULL)