So I’m having a rather annoying problem with the scaling of my sprites.
I’ve created a simple test app; it loads a spritesheet and sticks the first sprite on the screen.
@
this.setScale(10);
var cache = cc.SpriteFrameCache.getInstance();
cache.addSpriteFrames(“src/sprite.plist”, “src/sprite.png”);
this.sprite = cc.Sprite.createWithSpriteFrameName(this.spriteFrameNamePrefix + this.direction.toString() + “.png”);
//this.sprite.getTexture().setAliasTexParameters();
this.sprite.setPosition(new cc.Point(size.width / 2, size.height / 2));
this.addChild(this.sprite);
@
The problem I’ve got is that by scaling the layer (of my App subclass) it causes my sprite to get antialias scaled … and thus it looks terrible.
From Cocos2d-iphone you’d expect to be able to call setAliasTexParameters - but as the texture object is a striaght HTMLImageObject that doesn’t work.
I’ve tried a few things that don’t work e.g.
* Changing the size of my sprite from 11x21 to 12x22; same result
* Creating the way I load the sprite sheet so I manually create a cc.Texture2D and load a cc.Image onto that; cc.Image isn’t finished and you get random other errors due to lack of conf methods
* Scaling the sprite rather than the layer; same result
I’ve also tried playing around with canvas CSS properties but its all to no avail.
Am I missing something, I really like the look of Cocos2D-html5 but this issue is a show stopper. So far the only solution I can think of is to manually scale my sprites and store multiple different “scale” versions of them
Please help
Rich