Looping instead of stretching sprites

Looping instead of stretching sprites
0.0 0


Is it possible to loop a certain texture to scale the sprite up instead of stretching the texture?

For example, I have a texture of size 32x32. Then I created a sprite with a size of 96x96. Instead of stretching the texture up to 300%, I want it so that the texture is repeated 3 times horizontally and 3 times vertically, resulting in nine 32x32 textures.

I’m mainly doing this for a popup window type thing, where the corners remain the same size while the edges and the center are repeated. I am currecntly using CCScale9Sprite but what it does is it stretches the textures, resulting in weird artifacts when displayed on an HD device (in this case, Samsung Galaxy S4).

Thanks in advance.


Have you preapred a 9-Patch PNG file for this, or are you using a regular one?
You could also write your own CCSprite subclass to achieve this.