在Windows手机上创建游戏循环?(Creating Game Loop on windows phone?)

编程入门 行业动态 更新时间:2024-10-22 02:57:19
在Windows手机上创建游戏循环?(Creating Game Loop on windows phone?)

我想问一下,如果我想在我的2D Silverlight游戏(像蛇一样的样本游戏)中创建用于控制运动的agame循环,它将在Windows Phone上运行,这样做的最佳做法是什么? 我发现使用了不同的方法:1- CompositionTarget.Render()。 2-调度程序计时器。 3- stroy板。

哪个更适合创建示例游戏循环?

i want to ask if i want to create agame loop for controling motion in my 2D Silverlight game ( sample game like snake) which will run on Windows Phone , what is the best practice to do this ? i found different methods used: 1- CompositionTarget.Render(). 2- Dispatcher Timer. 3- stroy board.

which is more suitable for creating sample game loop ?

最满意答案

在列出的方法中,DIspatcher Timer是创建游戏循环的最佳方法。

但是,我强烈建议你不要使用Silverlight,而是使用XNA API,如果你想创建一个游戏,即使像Snake这样的简单游戏更容易用游戏架构编写游戏,Silverlight专为事件驱动的应用程序而设计(普通的应用程序)和XNA是专为游戏设计的(更新逻辑,然后在GPU上绘制2D或3D图像)。 此外,如果您坚持使用silverlight,除非您使用使用合​​成线程的故事板,您的绘图都不会被硬件加速,并且会降低应用程序的性能。

此外,如果您专门针对Windows Phone 8,则可以创建Direct3D应用程序并使用DirectX Toolkit在C ++中获取“xna”spritebatch类。 将使用该方法自动为您设置游戏循环和2D绘图代码。

Out of your methods listed, DIspatcher Timer is the best method for creating a game loop.

HOWEVER, I strongly encourage you not to use Silverlight and instead use the XNA API if you want to create a game, even for simple games like Snake its much easier to program a game with game architecture, Silverlight is designed for Event-Driven Applications (normal apps) and XNA is designed specifically with games in mind (Update Logic, then Drawing 2D or 3D images on the GPU). Also, if you stick with silverlight unless you use storyboards that make use of the composition thread, none of your drawing will be hardware-accelerated and will really slow down the performance of your application.

Also, if you target Windows Phone 8 specifically you can create a Direct3D app and use the DirectX Toolkit to get the "xna" spritebatch class in C++. A game loop and 2D drawing code will be automatically setup for you using that method.

更多推荐

本文发布于:2023-08-03 12:55:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1392002.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:机上   游戏   Creating   Windows   windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!