📄 d3dfont.h
字号:
// --------------------------------------------------------------------------
// Dingus project - a collection of subsystems for game/graphics applications
// --------------------------------------------------------------------------
#ifndef D3D_FONT_H__
#define D3D_FONT_H__
namespace dingus {
/**
* Texture-based font class for doing text in a 3D scene.
* Note: messes up with device state, so reset cached state/objs after using it.
*/
class CD3DFont {
public:
enum eCreateFlags { BOLD = 1, ITALIC = 2, ZENABLE = 4 };
enum eRenderFlags { CENTERED_X = 1, CENTERED_Y = 2, TWO_SIDED = 4, FILTERED = 8 };
public:
CD3DFont( const TCHAR* fontName, int height, int flags=0 );
~CD3DFont();
HRESULT drawText(
float x, float y, D3DCOLOR color, const TCHAR* str, int flags=0 );
/*
HRESULT drawTextScaled(
float x, float y, float z, float xScale, float yScale,
D3DCOLOR color, const TCHAR* str, int flags=0 );
HRESULT render3DText( const TCHAR* str, int flags=0 );
HRESULT getTextExtent( const TCHAR* str, SIZE& resSize ) const;
*/
// Initializing and destroying device-dependent objects
HRESULT createDeviceObjects();
HRESULT activateDeviceObjects();
HRESULT passivateDeviceObjects();
HRESULT deleteDeviceObjects();
protected:
TCHAR mFontName[80];
int mFontHeight;
int mFontFlags;
IDirect3DTexture9* mTexture;
IDirect3DVertexBuffer9* mVB;
int mTexWidth;
int mTexHeight;
float mTextScale;
float mTexCoords[128-32][4];
int mSpacing;
IDirect3DStateBlock9* mBlockSaved;
IDirect3DStateBlock9* mBlockDrawText;
};
}; // namespace dingus
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -