SurfaceView/CanvasView 一般问题
所以这是一个非常普遍的问题,但我已经想知道有一段时间了,想看看是否有人对此有建议。
根据我以前的经验,与某些人一样,使用 SurfaceView 和/或 CanvasView 来显示图形、绘制像素和制作动画非常简单和直接。我个人更多地将 SurfaceViews 用于动画,因为它们针对动画进行了更优化。通过测试,我发现 SurfaceViews 在某些手机(例如:Motorola Droid)上会出现很多滞后,但在其他手机(例如:Droid Incredible)上运行平稳。我想知道是否有人知道运行流畅且比 SurfaceView 和/或 CanvasView 更高效的视图或显示方法,特别是对于动画。多谢。
我主要想知道这一点,因为我不明白为什么有些游戏可以在我的速度较慢的手机上运行得如此流畅,尽管它们比我使用 SurfaceView 的简单游戏有更多的动画。
So this is a pretty general question, but I've been wondering about it for a while now and wanted to see if anyone had a suggestion on this.
In my previous experiences, as with some people's, using SurfaceViews and/or CanvasViews to display graphics, draw pixels, and do animations is very easy and straightforward. I personally use SurfaceViews more for animations since they are more optimized for it. I've realized from doing tests that SurfaceViews tent to lag a lot on certain phones (example: Motorola Droid) but run smoothly on others (example: Droid Incredible). I was wondering if anyone knows of views or display methods that run smoothly and are more efficient than SurfaceViews and/or CanvasViews, especially for animiations. Thanks a lot.
I primarily want to know this because I don't understand how some games can run so smoothly on my slower phones even though they have tons more animations than my simple game using a SurfaceView.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Chris Pruett 在他关于为 Android 创建实时游戏的演讲中很好地回答了这个问题。他做了两场演讲,但我认为第一个是:http://www.youtube.com/watch? v=U4Bk5rmIpic 包含它。
一般来说,GLSurfaceView 总是优于或等于 SurfaceView,但是如果您仅渲染少量对象,则 SurfaceView 可能会显得更好。至于手机的差异,我相信他的第二次演讲(I/O 2010)对此进行了深入探讨。
This question is answered really well by Chris Pruett in his presentations on creating real-time games for Android. He did two presentations but I think the first one: http://www.youtube.com/watch?v=U4Bk5rmIpic has it in.
In general terms, GLSurfaceView will always be better or equal to SurfaceView, however if you are only rendering a small number of objects then SurfaceView can appear to be better. As for the phone discrepancy, I believe his second presentation (I/O 2010) covers that in depth.
对于那些有大量动画的游戏,最好使用 GLSurfaceView ,它是使用 OpenGL ES 优化的 SurfaceView 。但我也想知道,因为我已经测试过使用 GLSurfaceView 与 SurfaceView 进行绘图比较,结果仍然是 SurfaceView 更好。无论如何,没有 CanvasView 这样的东西。 :)
For those games with a lot of animation, it would be good to use GLSurfaceView , it's SurfaceView optimised with OpenGL ES . but I wonder too, because I've tested drawing using GLSurfaceView compared with SurfaceView , and the result is still better for SurfaceView. anyway there's no such thing as CanvasView. :)