Is it possible to restore a GraphicsDevice if something goes wrong with it?

你离开我真会死。 提交于 2019-12-14 03:53:09

问题


I'm having this nasty problem with my game randomly crashing when changing the game window size, and I can't seem to find the source of the issue, so I'd like to try and approach this from another angle.

Say the GraphicsDevice got disposed somehow. Can I recreate it or return it to its working state, so the game could continue running?


回答1:


Nope.

That instance is coupled to so many things, that using a new one after that's been disposed in its life cycle would be pratically reimplementing XNA. If you're trying to use it and it's been disposed, you're doing something very wrong. And you can't make things right by fixing a small implementation error with a huge design and project error.

For your own good, try to figure out what you've done wrong, and fix that instead. Check whether everything you're doing is being done at the right moment.



来源:https://stackoverflow.com/questions/16656002/is-it-possible-to-restore-a-graphicsdevice-if-something-goes-wrong-with-it

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!