绘制对象与位图 [英] Drawable vs. Bitmap

查看:126
本文介绍了绘制对象与位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个实时游戏为Android,看着从SDK中提供的样品一些code后,我很困惑,当我应该使用位图或< STRONG>绘制对象我在我的游戏精灵。

I am writing a real-time game for Android, and after looking at some code from the samples provided in the SDK, I am confused as to when I should use Bitmap or Drawable for my sprites in my game.

有什么区别?哪一个是最好(快)的精灵,哪一个是静态背景?

What's the difference? Which one is better (faster) for sprites and which one is better for a static background?

推荐答案

要得到一个想法,这是更好,你可能想要观看此视频:

To get an idea which is better you may want to watch this video:

http://www.youtube.com/watch?v=U4Bk5rmIpic

有趣的是,他不是一个Java程序员开始,但一个有经验的游戏程序员,他的方法可以帮助你编写测试,以确定这将是最好的。

What is interesting is that he wasn't a java programmer to start with, but an experienced game programmer, and his approach may help you write tests to determine which will be best.

例如,您可能会发现位图是一个背景图像更好,如果你确实有一个静态的背景,但是,如果你要通过编程改变它,那么你可能有问题。

For example, you may find that the Bitmap is better for a background image, if you actually have a static background, but, if you are going to be programmatically changing it then you may have a problem.

有除了速度等方面的考虑,虽然,因为你可能会发现,记忆,例如,将是一个问题,你要多少精灵让屏幕在同一时间上会是一个问题。

There are other considerations besides speed though, as you may find that memory, for example, will be an issue, and how many sprites you want to have on the screen at one time will be an issue.

这篇关于绘制对象与位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆