Exemplo n.º 1
0
 /// <unmanaged>HRESULT IDirect3DDevice9::Clear([In] unsigned int Count,[In, Buffer, Optional] const D3DRECT* pRects,[In] D3DCLEAR Flags,[In] D3DCOLOR Color,[In] float Z,[In] unsigned int Stencil)</unmanaged>
 private unsafe HRESULT Clear_(int count, D3DRECT[] rectsRef, D3DCLEAR flags, D3DCOLOR color, float z, int stencil)
 {
     fixed(void *pRects = rectsRef)
     {
         //result = calli(System.Int32(System.Void*,System.Int32,System.Void*,System.Int32,SharpDX.Mathematics.Interop.RawColorBGRA,System.Single,System.Int32), this._nativePointer, count, ptr, flags, color, z, stencil, *(*(IntPtr*)this._nativePointer + (IntPtr)43 * (IntPtr)sizeof(void*)));
         return((HRESULT)NativeHelper.CalliInt32(43, _nativePointer, count, pRects, (int)flags, (int)color, z, stencil));
     }
 }
Exemplo n.º 2
0
        public unsafe D3DRECT MeasureText(D3DXSprite sprite, string text, DT drawFlags)
        {
            D3DRECT  rect;
            D3DCOLOR color  = -1;
            int      format = (int)(drawFlags | DT.DT_CALCRECT);

            DrawText(sprite, text, text.Length, (IntPtr)(void *)&rect, format, color);
            return(rect);
        }
Exemplo n.º 3
0
 public HRESULT Clear(D3DCLEAR clearFlags, D3DCOLOR color, float zdepth, int stencil)
 {
     return(Clear_(0, null, clearFlags, color, zdepth, stencil));
 }
Exemplo n.º 4
0
        public unsafe HRESULT Draw(Direct3DTexture9 texture, D3DRECT?rect, D3DXVECTOR3?center, D3DXVECTOR3?position, D3DCOLOR color)
        {
            D3DRECT     vRect     = rect.HasValue ? rect.Value : default(D3DRECT);
            D3DXVECTOR3 vCenter   = center.HasValue ? center.Value : default(D3DXVECTOR3);
            D3DXVECTOR3 vPosition = position.HasValue ? position.Value : default(D3DXVECTOR3);

            return(Draw(
                       texture,
                       rect.HasValue ? (IntPtr)(void *)&vRect : IntPtr.Zero,
                       center.HasValue ? (IntPtr)(void *)&vCenter : IntPtr.Zero,
                       position.HasValue ? (IntPtr)(void *)&vPosition : IntPtr.Zero,
                       color));
        }
Exemplo n.º 5
0
 /// <unmanaged>HRESULT ID3DXSprite::Draw([In] IDirect3DTexture9* pTexture,[In] const void* pSrcRect,[In] const void* pCenter,[In] const void* pPosition,[In] D3DCOLOR Color)</unmanaged>
 private unsafe HRESULT Draw(Direct3DTexture9 texture, IntPtr srcRect, IntPtr center, IntPtr position, D3DCOLOR color)
 {
     //calli(System.Int32(System.Void*,System.Void*,System.Void*,System.Void*,System.Void*,SharpDX.Mathematics.Interop.RawColorBGRA), this._nativePointer, (void*)((textureRef == null) ? IntPtr.Zero : textureRef.NativePointer), (void*)srcRectRef, (void*)centerRef, (void*)positionRef, color, *(*(IntPtr*)this._nativePointer + (IntPtr)9 * (IntPtr)sizeof(void*))).CheckError();
     return((HRESULT)NativeHelper.CalliInt32(9, _nativePointer,
                                             (void *)(texture == null ? IntPtr.Zero : texture.NativePointer),
                                             (void *)srcRect,
                                             (void *)center,
                                             (void *)position,
                                             (int)color));
 }
Exemplo n.º 6
0
        /// <unmanaged>int ID3DXFont::DrawTextW([In] ID3DXSprite* pSprite,[In] const wchar_t* pString,[In] int Count,[In] void* pRect,[In] unsigned int Format,[In] D3DCOLOR Color)</unmanaged>
        private unsafe int DrawText(D3DXSprite sprite, string text, int count, IntPtr rectRef, int format, D3DCOLOR color)
        {
            var pString = Marshal.StringToHGlobalUni(text);
            //result = calli(System.Int32(System.Void*,System.Void*,System.Void*,System.Int32,System.Void*,System.Int32,SharpDX.Mathematics.Interop.RawColorBGRA), this._nativePointer, (void*)((spriteRef == null) ? IntPtr.Zero : spriteRef.NativePointer), (void*)intPtr, count, (void*)rectRef, format, color, *(*(IntPtr*)this._nativePointer + (IntPtr)15 * (IntPtr)sizeof(void*)));
            var result = NativeHelper.CalliInt32(15, _nativePointer,
                                                 (void *)(sprite == null ? IntPtr.Zero : sprite.NativePointer),
                                                 (void *)pString,
                                                 (int)count,
                                                 (void *)rectRef,
                                                 (int)format,
                                                 (int)color);

            Marshal.FreeHGlobal(pString);
            return(result);
        }
Exemplo n.º 7
0
        public unsafe int DrawText(D3DXSprite sprite, string text, D3DRECT rect, DT drawFlags, D3DCOLOR color)
        {
            var result = DrawText(sprite, text, text.Length, (IntPtr)(void *)&rect, (int)drawFlags, color);

            if (result == 0)
            {
                //"Draw failed"
                throw new DirectXException(0);
            }
            return(result);
        }