Game page navigation

最后都变了- 提交于 2019-12-12 05:37:26

问题


I am trying to build an simple game using XNA 4.0 on Windows Phone.
On my project, I will have 2 page, MenuScreen and GameplayScreen. In Silverlight, I can add new page easily And I can use NavigationService.Navigate("/blablabla.xaml") to move to another page on my project.
How can I do that on XNA? There are no page options when I want to add new item.


回答1:


Because XNA hasn't the concept of page. If you need to use Silverlight you can easily create a project that use XNA and Silverlight, merging their features.
Otherwise, if you can't use Silverlight in your project, you have to implement your MenuScreen class that will manage what you need (buttons and detecting touches) and then, when you want to launch the GameplayScreen, you simply call your class that manage your game (like a sprite manager or a model manager), hiding the menu class or deactivating it.
Of course every class has to inherit from DrawableGameComponent.



来源:https://stackoverflow.com/questions/18544522/game-page-navigation

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