|
|
|
ID3DXFont Interface |
|
' ****************************************************************************************
' ID3DXFont interface
' $IID_ID3DXFont = GUID$("{D79DBB70-5F21-4d36-BBC2-FF525C213CDC}")
' ****************************************************************************************
' ****************************************************************************************
' The ID3DXFont interface encapsulates the textures and resources needed to render a specific
' font on a specific device.
' Remarks
' The ID3DXFont interface is obtained by calling D3DXCreateFont or D3DXCreateFontIndirect.
' Interface Information
' Stock Implementation d3d9.dll
' Custom Implementation No
' Inherits from IUnknown
' Header d3dx9core.h
' Import library d3dx9.lib
' Minimum operating systems Windows 98
' ****************************************************************************************
' ****************************************************************************************
'DECLARE_INTERFACE_(ID3DXFont, IUnknown)
'{
' // IUnknown
' 0. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
' 1. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
' 2. STDMETHOD_(ULONG, Release)(THIS) PURE;
' // ID3DXFont
' 3. STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE;
' 4. STDMETHOD(GetDescA)(THIS_ ID3DXFont_DESCA *pDesc) PURE;
' 5. STDMETHOD(GetDescW)(THIS_ ID3DXFont_DESCW *pDesc) PURE;
' 6. STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE;
' 7. STDMETHOD_(BOOL, GetTextMetricsW)(THIS_ TEXTMETRICW *pTextMetrics) PURE;
' 8. STDMETHOD_(HDC, GetDC)(THIS) PURE;
' 9. STDMETHOD(GetGlyphData)(THIS_ UINT Glyph, LPDIRECT3DTEXTURE9 *ppTexture, RECT *pBlackBox, POINT *pCellInc) PURE;
' 10. STDMETHOD(PreloadCharacters)(THIS_ UINT First, UINT Last) PURE;
' 11. STDMETHOD(PreloadGlyphs)(THIS_ UINT First, UINT Last) PURE;
' 12. STDMETHOD(PreloadTextA)(THIS_ LPCSTR pString, INT Count) PURE;
' 13. STDMETHOD(PreloadTextW)(THIS_ LPCWSTR pString, INT Count) PURE;
' 14. STDMETHOD_(INT, DrawTextA)(THIS_ LPD3DXSPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE;
' 15. STDMETHOD_(INT, DrawTextW)(THIS_ LPD3DXSPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE;
' 16. STDMETHOD(OnLostDevice)(THIS) PURE;
' 17. STDMETHOD(OnResetDevice)(THIS) PURE;
' ****************************************************************************************
' ****************************************************************************************
' GetDevice method
' Retrieves the Microsoft Direct3D device associated with the font object.
' HRESULT GetDevice(
' LPDIRECT3DDEVICE9 * ppDevice
' );
' ****************************************************************************************
FUNCTION ID3DXFont_GetDevice ALIAS "ID3DXFont_GetDevice" ( _
BYVAL pthis AS DWORD PTR, BYREF ppDevice AS DWORD) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[3] USING ID3DXFont_GetDevice(pthis, ppDevice) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' GetDescA method
' Gets a description of the current font object. GetDescW and GetDescA are identical,
' except that a pointer is returned to a ID3DXFont_DESCW or ID3DXFont_DESCA structure,
' respectively.
' HRESULT GetDescA(
' ID3DXFont_DESCA * pDesc
' );
' ****************************************************************************************
FUNCTION ID3DXFont_GetDescA ALIAS "ID3DXFont_GetDescA" ( _
BYVAL pthis AS DWORD PTR, BYREF pDesc AS D3DXFONT_DESCA) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[4] USING ID3DXFont_GetDescA(pthis, pDesc) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' GetDescW method
' Gets a description of the current font object. GetDescW and GetDescA are identical,
' except that a pointer is returned to a ID3DXFont_DESCW or ID3DXFont_DESCA structure,
' respectively.
' HRESULT GetDescW(
' ID3DXFont_DESCW * pDesc
' );
' ****************************************************************************************
FUNCTION ID3DXFont_GetDescW ALIAS "ID3DXFont_GetDescW" ( _
BYVAL pthis AS DWORD PTR, BYREF pDesc AS D3DXFONT_DESCW) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[5] USING ID3DXFont_GetDescW(pthis, pDesc) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' GetTextMetricsA method
' Retrieves the Microsoft Direct3D device associated with the font object.
' BOOL GetTextMetricsA(
' TEXTMETRIC * pTextMetrics
' );
' ****************************************************************************************
FUNCTION ID3DXFont_GetTextMetricsA ALIAS "ID3DXFont_GetTextMetricsA" ( _
BYVAL pthis AS DWORD PTR, BYREF pTextMetrics AS TEXTMETRIC) EXPORT AS LONG
LOCAL LRESULT AS LONG
IF pthis = %NULL THEN EXIT FUNCTION
CALL DWORD @@pthis[6] USING ID3DXFont_GetTextMetricsA(pthis, pTextMetrics) TO LRESULT
FUNCTION = LRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' GetTextMetricsW method
' Retrieves the Microsoft Direct3D device associated with the font object.
' BOOL GetTextMetricsW(
' TEXTMETRIC * pTextMetrics
' );
' ****************************************************************************************
FUNCTION ID3DXFont_GetTextMetricsW ALIAS "ID3DXFont_GetTextMetricsW" ( _
BYVAL pthis AS DWORD PTR, BYREF pTextMetrics AS TEXTMETRIC) EXPORT AS LONG
LOCAL LRESULT AS LONG
IF pthis = %NULL THEN EXIT FUNCTION
CALL DWORD @@pthis[7] USING ID3DXFont_GetTextMetricsW(pthis, pTextMetrics) TO LRESULT
FUNCTION = LRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' GetDC method
' Returns a handle to a display device context (DC) that has the font set.
' HDC GetDC();
' ****************************************************************************************
FUNCTION ID3DXFont_GetDC ALIAS "ID3DXFont_GetDC" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD
LOCAL DWRESULT AS DWORD
IF pthis = %NULL THEN EXIT FUNCTION
CALL DWORD @@pthis[8] USING ID3DXFont_GetDC(pthis) TO DWRESULT
FUNCTION = DWRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' GetGlyphData method
' Returns information about the placement and orientation of a glyph in a character cell.
' HRESULT GetGlyphData(
' UINT Glyph,
' LPDIRECT3DTEXTURE9 * ppTexture,
' RECT * pBlackBox,
' POINT * pCellInc
' );
' ****************************************************************************************
FUNCTION ID3DXFont_GetGlyphData ALIAS "ID3DXFont_GetGlyphData" ( _
BYVAL pthis AS DWORD PTR, BYVAL Glyph AS DWORD, BYREF ppTexture AS DWORD, _
BYREF pBlackBox AS RECT, BYREF pCellInc AS POINTAPI) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[9] USING ID3DXFont_GetGlyphData(pthis, Glyph, ppTexture, pBlackBox, pCellInc) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' PreloadCharacters method
' Loads a series of characters into video memory to improve the efficiency of rendering to
' the device.
' HRESULT PreloadCharacters(
' UINT First,
' UINT Last
' );
' ****************************************************************************************
FUNCTION ID3DXFont_PreloadCharacters ALIAS "ID3DXFont_PreloadCharacters" ( _
BYVAL pthis AS DWORD PTR, BYVAL First AS DWORD, BYVAL Last AS DWORD) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[10] USING ID3DXFont_PreloadCharacters(pthis, First, Last) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' PreloadGlyphs method
' Loads a series of glyphs into video memory to improve the efficiency of rendering to the
' device.
' HRESULT PreloadGlyphs(
' UINT First,
' UINT Last
' );
' ****************************************************************************************
FUNCTION ID3DXFont_PreloadGlyphs ALIAS "ID3DXFont_PreloadGlyphs" ( _
BYVAL pthis AS DWORD PTR, BYVAL First AS DWORD, BYVAL Last AS DWORD) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[11] USING ID3DXFont_PreloadGlyphs(pthis, First, Last) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' PreloadTextA method
' Loads formatted text into video memory to improve the efficiency of rendering to the
' device.
' HRESULT PreloadTextA(
' LPCSTR * pString,
' INT Count
' );
' ****************************************************************************************
FUNCTION ID3DXFont_PreloadTextA ALIAS "ID3DXFont_PreloadTextA" ( _
BYVAL pthis AS DWORD PTR, BYREF pString AS ASCIIZ, BYVAL Count AS LONG) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[12] USING ID3DXFont_PreloadTextA(pthis, pString, Count) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' PreloadTextW method
' Loads formatted text into video memory to improve the efficiency of rendering to the
' device.
' HRESULT PreloadTextW(
' LPCWSTR * pString,
' INT Count
' );
' ****************************************************************************************
FUNCTION ID3DXFont_PreloadTextW ALIAS "ID3DXFont_PreloadTextW" ( _
BYVAL pthis AS DWORD PTR, BYVAL pString AS DWORD, BYVAL Count AS LONG) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[13] USING ID3DXFont_PreloadTextW(pthis, pString, Count) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' DrawTextA method
' Draws formatted text.
' INT DrawTextA(
' LPD3DXSPRITE pSprite,
' LPCSTR pString,
' INT Count,
' LPRECT pRect,
' DWORD Format,
' D3DCOLOR Color
' );
' ****************************************************************************************
FUNCTION ID3DXFont_DrawTextA ALIAS "ID3DXFont_DrawTextA" ( _
BYVAL pthis AS DWORD PTR, BYVAL pSprite AS DWORD, BYREF pString AS ASCIIZ, _
BYVAL Count AS LONG, BYREF pRect AS RECT, BYVAL prmFormat AS DWORD, _
BYVAL prmColor AS DWORD) EXPORT AS LONG
LOCAL LRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[14] USING ID3DXFont_DrawTextA(pthis, pSprite, pString, Count, pRect, prmFormat, prmColor) TO LRESULT
FUNCTION = LRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' DrawTextW method
' Draws formatted text.
' INT DrawTextW(
' LPD3DXSPRITE pSprite,
' LPCWSTR pString,
' INT Count,
' LPRECT pRect,
' DWORD Format,
' D3DCOLOR Color
' );
' ****************************************************************************************
FUNCTION ID3DXFont_DrawTextW ALIAS "ID3DXFont_DrawTextW" ( _
BYVAL pthis AS DWORD PTR, BYVAL pSprite AS DWORD, BYVAL pString AS DWORD, _
BYVAL Count AS LONG, BYREF pRect AS RECT, BYVAL prmFormat AS DWORD, _
BYVAL prmColor AS DWORD) EXPORT AS LONG
LOCAL LRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[15] USING ID3DXFont_DrawTextW(pthis, pSprite, pString, Count, pRect, prmFormat, prmColor) TO LRESULT
FUNCTION = LRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' OnLostDevice method
' Releases all references to video memory resources and deletes all stateblocks.
' HRESULT OnLostDevice();
' ****************************************************************************************
FUNCTION ID3DXFont_OnLostDevice ALIAS "ID3DXFont_OnLostDevice" (BYVAL pthis AS DWORD PTR) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[16] USING ID3DXFont_OnLostDevice (pthis) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' OnResetDevice method
' Should be called after the device has been reset.
' HRESULT OnResetDevice();
' ****************************************************************************************
FUNCTION ID3DXFont_OnResetDevice ALIAS "ID3DXFont_OnResetDevice" (BYVAL pthis AS DWORD PTR) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[17] USING ID3DXFont_OnResetDevice (pthis) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
|
Page last updated on Tuesday, 14 March 2006 22:27:36 +0100