SurfaceView/CanvasView 一般问题

发布于 2024-10-16 22:47:33 字数 408 浏览 2 评论 0原文

所以这是一个非常普遍的问题,但我已经想知道有一段时间了,想看看是否有人对此有建议。

根据我以前的经验,与某些人一样,使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

安穩 2024-10-23 22:47:33

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.

舂唻埖巳落 2024-10-23 22:47:33

对于那些有大量动画的游戏,最好使用 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. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文