본문 바로가기

카테고리 없음

D3D 그래픽디바이스(LPD3DXFONT, D3DXFONT_DESCW ,D3DXCreateFontIndirect, DrawTextW())

LPD3DXFONT

D3D에서 문자를 출력하기 위한 com객체이다.

지정한 장치와폰트를 렌더링 하기 위해서 필요한 텍스처와 리소스를 캡슐화 하기 위해서 사용한다.

https://docs.microsoft.com/en-us/windows/win32/direct3d9/id3dxfont

 

ID3DXFont interface (D3dx9core.h) - Win32 apps

ID3DXFont interface In this article --> The ID3DXFont interface encapsulates the textures and resources needed to render a specific font on a specific device. Members The ID3DXFont interface inherits from the IUnknown interface. ID3DXFont also has these ty

docs.microsoft.com

 

typedef struct D3DXFONT_DESC {
   INT   Height;
   UINT  Width;
   UINT  Weight;
   UINT  MipLevels;
   BOOL  Italic;
   BYTE  CharSet;
   BYTE  OutputPrecision;
   BYTE  Quality;
   BYTE  PitchAndFamily;
   TCHAR FaceName;
} D3DXFONT_DESC, *LPD3DXFONT_DESC;

폰트의 정보값을 설정합니다. 폰트의크기,기울임,굵기,종류는 해당 부분에서 초기화가됩니다.

ID3DXFont의 로부터 인터페이스 상속 의 IUnknown 인터페이스를 제공합니다

https://docs.microsoft.com/en-us/windows/win32/direct3d9/d3dxfont-desc

 

D3DXFONT_DESC structure (D3dx9core.h) - Win32 apps

D3DXFONT_DESC structure In this article --> Defines the attributes of a font. Syntax typedef struct D3DXFONT_DESC { INT   Height; UINT  Width; UINT  Weight; UINT  MipLevels; BOOL  Italic; BYTE  CharSet; BYTE  OutputPrecision; BYTE  Quality; BYTE

docs.microsoft.com

HRESULT D3DXCreateFontIndirect(      

    LPDIRECT3DDEVICE9 pDevice,

    CONST LOGFONT *pLogFont,

    LPD3DXFONT *ppFont

);

장치와폰트용의폰트 객체를 간접적으로 생성한다.

지정한 폰트의 정보를 가지고 폰트 객체를 생성해줍니다. 

LPDIRECT3DDEVICE9 pDevice : 장치를 적용시키고자 하는 디바이스의 정보입니다.

CONST LOGFONT *pLogFont : D3DXFONT_DESCW로 만든 폰트의 정보의 포인터

LPD3DXFONT *ppFon : 생성 하고자하는폰트 객체 LPD3DXFONT 인터페이스 포인터로 반환합니다.

 

STDMETHOD_(INT, DrawTextW)(

  THIS_ LPD3DXSPRITE pSprite,

  LPCWSTR pString,

  INT Count,

  LPRECT pRect,

  DWORD Format,

  D3DCOLOR Color

) PURE;

https://docs.microsoft.com/ko-kr/windows/win32/api/winuser/nf-winuser-drawtextw?f1url=%3FappId%3DDev14IDEF1%26l%3DKO-KR%26k%3Dk(D3DX9CORE%252FID3DXFont%253A%253ADrawTextW);k(ID3DXFont%253A%253ADrawTextW);k(DrawTextW);k(DevLang-C%252B%252B);k(TargetOS-Windows)%26rd%3Dtrue

 

DrawTextW function (winuser.h) - Win32 apps

The DrawText function draws formatted text in the specified rectangle. It formats the text according to the specified method (expanding tabs, justifying characters, breaking lines, and so forth).

docs.microsoft.com

지정한 사각형에 해당 문자열을 그립니다.

THIS_ LPD3DXSPRITE pSprite : 자신이 그릴 스프라이트의 대한 정보를 받습니다.

LPCWSTR pString : 그리고자 하는 문자열을 받습니다.

INT Count : 문자열의 길이를 받습니다.

LPRECT pRect : 문자열을 그릴 4각형의 RECT정보입니다. 만약 nullptr을 대입할시 스프라이트 정보에들어있는 RECT의                        값을 4각형으로 잡습니다.

DWORD Format : 정렬방식 텍스트 서식을 지정하는 방법

D3DCOLOR Color : 글자의 색깔의 대한 정보를 받습니다.