是否可以从我的 GameObject 类访问 GraphicsDeviceManager?
好吧,所以我是这方面的初学者。
我有一个 GameObject 类,我希望该类能够访问图形设备,这样我就能够获取最大屏幕宽度。 我的目标是在创建从 GameObject 类继承的其他对象时使用 MaxScreen 宽度,也许应该有另一种更简单的方法来完成此操作,但是是的。
如果有人不明白任何事情,我很乐意解释更多。 多谢。
Alright, so I am a beginner in this.
I have a GameObject class, and I want this class to have access to the graphics device, so I'll be able to get the Max Screen width for example.
My target is to use the MaxScreen width when I create other objects that inherit from GameObject class, maybe there should be another easier way to do this thing, but yeah.
If anyone haven't understood anything, I'll be glad to explain more.
Thanks alot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要访问 GraphicsDevice,您需要对 XNA 类“Game”进行子类化。完成此操作后,您可以访问 GraphicsDevice 属性,并且如果您确实想与“Game”类版本中的其他对象共享它。我建议您完成 MSDN 上的“入门”部分并阅读简介。链接位于
XNA 入门此处
XNA框架简介此处
To get access to the GraphicsDevice you need to subclass the XNA class "Game". Once you've done that you can access the GraphicsDevice properties and if you really want to share it with other objects in your version of the "Game" class. I reccomend you complete the "Getting Started" section on MSDN and read the introduction. Links are below
XNA Getting Started here
Introduction to the XNA framework here