如何在 SFML.NET 中使用文本?
我刚刚下载了 SFML.NET 并添加了对其中包含的库 DLL 的引用,但似乎 Text 类不存在。在网站上的示例中,很明显正在使用 Text 对象......因此该示例将无法编译。亲自看看...
替代文本 http://filebox.me/files/5gubdwfcr_helpme.png
只有字体,没有文字!有人知道我可能做错了什么吗?
I just downloaded SFML.NET and added a reference to the library DLLs included with it, but it seems the Text class is not there. In the example on the site, it is clear that a Text object being used... so the example won't compile. See for yourself...
alt text http://filebox.me/files/5gubdwfcr_helpme.png
There's only Font, no Text! Anyone knows what I could be doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能正在查看 2.x 示例,其中 String2D 已被删除并替换为 Text。
String2D 适用于 1.x,您可以使用 Text 属性来更改它显示的内容。
幸运的是,这些接口非常相似。您应该能够简单地将声明为 Text 的任何内容替换为 String2D,并将 Text 属性更改为 DisplayedString,而无需更改任何其他代码。每个版本的示例:
VB.Net
SFML.NET 1.x
SFML.NET 2.x
C#
SFML.NET 1.x
SFML.NET 2.x
显然是非常简单的例子,但希望能够展示差异有多么简单。
You are probably looking at 2.x samples where String2D has been removed and replaced with Text.
String2D is for 1.x, and you use the Text property to change what it displays.
Fortunately the interfaces are very similar. You should be able to simply replace anything declared as Text with String2D and change the Text property to DisplayedString without changing any of the other code. An example for each version:
VB.Net
SFML.NET 1.x
SFML.NET 2.x
C#
SFML.NET 1.x
SFML.NET 2.x
Obviously a very stripped back example but hopefully demonstrates just how simple the difference is.
在最新的 SFML.net 中有
Text
类。使用与 C++ 中的相同,只是您必须处理 C#properties
In newest SFML.net there is
Text
class. The use is the same as in C++ except that You have to deal with C#properties
您可能想使用 String2D 类(文档中的 String 类)实际绘制文本。 教程中这个类的变量叫做Text,即可能你感到困惑的地方。
You probably want to use the String2D class (the String class in the documentation) to actually draw text. The variable of this class in the tutorial is called Text, which is probably where you were confused.