2.5(?) Text and Fonts Using cFont(字)
来源:互联网 发布:简单编程 编辑:程序博客网 时间:2024/05/19 14:54
2.5(?) Text and Fonts Using cFont(字)
。。。。。。。。。。。。。。。。。。。。。。。
class cFont { private: ID3DXFont *m_Font; // Font COM 对象 public: cFont(); // 构造函数 ~cFont(); // 析构函数 ID3DXFont *GetFontCOM(); // 返回 font COM 对象 // 创建和释放font BOOL Create(cGraphics *Graphics, char *Name, / long Size = 16, BOOL Bold = FALSE, / BOOL Italic = FALSE, BOOL Underline = FALSE, / BOOL Strikeout = FALSE); BOOL Free(); // 开始和结束文字的绘制 BOOL Begin(); BOOL End(); //打印指定的文本 BOOL Print(char *Text, long XPos, long YPos, / long Width = 0, long Height = 0, / D3DCOLOR Color = 0xFFFFFFFF, DWORD Format = 0); }; |
要使用一个font,你必须用cFont::Create函数创建。你必须通过一个已经初始化过的cGraphics对象,给他一个字体名称(如Times New Roman,宋体),并指定尺寸。你可以用选择的使用加粗、斜体、下划线、striceout(这后两个DX9不用了)
(那个Begin,End也不用了);
想要打印一行文本,你需要给cFont::Print函数提供一个指向你文本的指针,在哪开始打印的坐标,盒子(bounding box)尺寸(默认为0,意味着整个屏幕),文本颜色(默认为白色,使用D3DCOLOR_RGBA来定义一个颜色),文本格式如表,(我就不翻译这个表了,很容易理解吧):(在上面)
一个简单的例子:
// 如果 g_Graphics是一个已经初始化过的cGraphics 对象 cFont ArialFont; ArialFont.Create(&g_Graphics, “Arial”); // Arial 字体 16号 ArialFont.Print(“I can print fonts!”, 0,0); // 在 0,0点开始打印 |
- 2.5(?) Text and Fonts Using cFont(字)
- It is all about Using Text & Fonts in Flash
- PHP - PDT - General-Appearance-Colors and Fonts - Colors and Fonts-Basic-Text Font
- C++ TEXT CFont MulDiv
- unity-sysfont: Unity3D plugin for rendering dynamic text using device/platform fonts
- SourceInght And Sublime Text 2 Using Skills
- Labels and Fonts
- CFont
- CFont
- CFont
- [FLASH]Embed and Share Fonts
- 更改eclipse Fonts and Colors
- Words and Text: Using String Variables to Organize Words
- selector of text and background should using different attributes
- fonts
- Create, Read, Write, Copy, Move and Delete a Text File using C# and VB.NET
- Working with TrueType and Raster Fonts
- 字体和文本布局(Fonts and TextLayout)
- 2.3 Colors and cMaterial(颜色和材质)
- 跟老紫竹学Java-计数器-Hibernate版
- 2.4 Light It Up with cLitht(照耀他吧灯光!)
- 如何提高工作效率
- 跟老紫竹学Java-计数器项目
- 2.5(?) Text and Fonts Using cFont(字)
- notes[java]
- DBA的面试题也可以是这样
- Daniel J. Bernstein其人其事
- Spring_1.2.7 、 webwork_2.2.2及hibernate3的集成
- Linux(Ubuntu)下编译内核模块
- 面试题集
- const in C++
- CVS 安装配置总结