Cocos2D-iPhone – Need to help understand the elves and textures

I recently started to pay attention to cocos2d game development.

What is the difference between sprites and textures?
Maybe I can pass the “bitmap” there. What is a bitmap?

They all seem to be the same as 2D images.

The in-memory image drawn on the screen.

The sprite actually draws the texture on the screen, or just a specific rectangle of the texture. The sprite can be scaled, rotated, positioned, tilted, colored (colored), etc.

Multiple sprites can share the same texture. No matter how many sprites use the same texture, the texture will only be loaded into memory. In addition, with CCSpriteBatchNode, you can “batch” all sprites with the same texture For better performance.

Bitmap is a general term for computer graphics, where each pixel is represented by one or more bits. There is also the popular image format BMP on Windows. These Most people only say “images” because there are other forms of “bitmaps” that are not images. For example, in AI code, you often use bitmaps (bit arrays) to represent AI status information or for games Pathfinding algorithm for all regions of the world. That is, every region in the world may have a “blocking” bit or a “resource” bit, which can help AI make decisions.

See also Wikipedia:< /p>

> Texture Mapping
> Bitmap

I recently started to pay attention to cocos2d game development.

Spirits and textures What’s the difference?
Maybe I can pass the “bitmap” there. What is a bitmap?

They all seem to be the same as 2D images.

Textures are in-memory images that the device can draw on the screen.

< /p>

The sprite actually draws the texture on the screen, or just a specific rectangle of the texture. The sprite can be scaled, rotated, positioned, tilted, colored (colored), etc..

Multiple sprites can be shared The same texture. No matter how many sprites use the same texture, the texture will only be loaded into memory. In addition, using CCSpriteBatchNode, you can “batch” the drawing of all sprites using the same texture for better performance.

Bitmap is a general term for computer images, in which each pixel is represented by one or more bits. There is also the popular image format BMP on Windows. Most people just say “image” these days, because There are other forms of “bitmaps” that are not images. For example, in AI code, you often use bitmaps (bit arrays) to represent AI’s state information or pathfinding algorithms for all areas of the game world. That is, the world’s Each area may have a “blocking” bit or a “resource” bit, which can help AI make decisions.

See also Wikipedia:

> Texture Mapping
> Bitmap

Leave a Comment

Your email address will not be published.