Swapping palettes using CCTexture2DMutable
Another way to palette swap involves sentinel colors and the ability to modify a texture pixel by pixel. This method can help reclaim some extra space on the disk and in memory but it tends to take a lot of CPU time. It is also messier than the previous technique when used with anti-aliased or blended textures.
Getting ready
Please refer to the project RecipeCollection01
for full working code of this recipe. Also note the included library CCTexture2DMutable
that is not included in the book itself.
For this recipe you will need an image manipulation program. Once again I recommend the free and easy to use ...
Get Cocos2d for iPhone 1 Game Development Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.