Open SudoPlz opened 10 years ago
If that is too much to ask then please tell me of a way to scale down my assets in order to support other resolutions (Android devices) with different width and height scale factors. Having one generic scale factor does not work so well for me.
Hi, you set dbswf texture scale like this factory = new StarlingFactory(); //only support scale dbswf texture factory.scaleForTexture = 2; factory.parseData();
factory.scaleForTexture = 2;
works when we deal with iOS.. Things are simple on iOS because the screens have similar ratois, but what about Android.. ScaleFactor does not work well there since there are so many different resolutions with different aspect ratios... correct?
I need to different scale ratios, one for width and one for height.
Perhaps if there was:
factory = new StarlingFactory();
//only support scale dbswf texture
factory.setScaleForTexture(wScale, hScale);
factory.parseData();
you mast get scale ratios youself, and set the scaleForTexture
Yes but don't you see? Even setting the correct scaleForTexture will not do, because it scales down proportionally and that is not always wanted. I want to be able to scale all the textures unproportionally like so:
factory.setScaleForTexture(wScale, hScale);
Is that hard to implement?
Ok let me show you what I tried to do.. I created MyCustomStarlingFactory
and changed the following lines on this funtion override protected function generateTextureAtlas(content:Object, textureAtlasRawData:Object):ITextureAtlas
What I changed:
var width:int = getNearest2N(content.width) * scaleForTexture;
var height:int = getNearest2N(content.height) * scaleForTexture;
is now
var width:int = getNearest2N(content.width* wScaleForTexture);
var height:int = getNearest2N(content.height* hScaleForTexture);
_helpMatrix.scale(scaleForTexture, scaleForTexture);
is now:
_helpMatrix.scale(wScaleForTexture, hScaleForTexture);
texture = Texture.fromBitmapData(bitmapData, generateMipMaps, optimizeForRenderToTexture, scaleForTexture);
is now
texture = Texture.fromBitmapData(bitmapData, generateMipMaps, optimizeForRenderToTexture, 1);
This worked fine and I can improportionally scale most of my animation BUT I have a problem. For some reason I get wrong visual on my animations.
It should look like this: but for some reason it looks like this: I don't get it... It worked for other animations. Could it be because this one uses a shape tween?
This is what my dragonbones generated spritesheet looks like:
Ok since flash sprites are already Vectors, why don't you guys take advantage of that and just create the correct size Texture Atlas during runtime, depending on the width and height the user provides you (which might be different from device to device?) Pretty much what DMT does for static sprites. Its open source and you can perhaps borrow some code, Gil has done a fantastic job on it.
It would be great if it worked like this:
var factory:StarlingFactory = new StarlingFactory();
factory.parseData(loader.content, screenWidth, screenHeight); //create the correct size Texture atlas during RunTime like Dmt does.