Articlename: DirectX Text mit ID3DXFONT Keywords: ID3DXFONT, LPD3DXFONT, Schrift mit DirectX Date: 31.07.2007, 19:38 Views: 2040 Categoryname: DirectX ---------------------------------------- Der folgende Code beschreibt die benutzung von ID3DXFONT: font.h: ------- Code ------- #pragma once //Header #include //File for DirectXGraphics #include //Filfe for DirectXGraphics #include //Standard I/O header //Defines #define DLLEXPORT __declspec(dllexport) //Font informations struct bn_FontInformations { //Width of the font int iWidth; //Weight of the font int iWeight; //Height of the font int iHeight; //Specifies the character set for example: TURKISH_CHARSET;DEFAULT_CHARSET int iCharSet; //Specifies the pitch and family of the font FF_DECORATIVE;FF_DONTCARE;FF_MODERN int iPitchAndFamily; //Tests if it's italic bool bItalic; //The name of the font char *pFontName; }; //Class for the font class bn_Font { public: //Initialise DirectXGraphics bn_Font(); //Desturktor clears the class ~bn_Font(); //Initialise DirectXGraphics void Initialise(LPDIRECT3DDEVICE9 lpD3DDevice,bn_FontInformations FontInfo); //Draws the Text void DrawText(char *pText,int iX,int iY,int iWidth = 0,int iHeight = 0,D3DCOLOR TextColor = D3DCOLOR_XRGB(0xFF,0xFF,0)); //If the device'll be reseted void OnLostDevice(); //If the device has been reseted void OnResetDevice(); protected: //The font LPD3DXFONT m_lpD3DFont; //If it's initialised bool m_bInitialise; }; ------- End-Code ------- font.cpp: ------- Code ------- //******************************* FOR MORE SEE THE .h file ********************************/ / #include "font.h" //Copy src to dest for size chars inline void CopyPointingString(char *pTarget,char *pSource,int size) { for(int i=0; i