Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drawable vs. Bitmap [duplicate]

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?

like image 723
Jesse Avatar asked May 03 '11 23:05

Jesse


1 Answers

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

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

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.

like image 166
James Black Avatar answered Nov 07 '22 06:11

James Black