Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improportionate scale..! (Perhaps vector to raster?) #49

Open
SudoPlz opened this issue Aug 27, 2014 · 7 comments
Open

Improportionate scale..! (Perhaps vector to raster?) #49

SudoPlz opened this issue Aug 27, 2014 · 7 comments

Comments

@SudoPlz
Copy link

SudoPlz commented Aug 27, 2014

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.

@SudoPlz SudoPlz changed the title Vector to raster in order to save scale problems? Vector to raster in order to (once and for all) get rid of scale problems? Aug 27, 2014
@SudoPlz
Copy link
Author

SudoPlz commented Aug 27, 2014

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.

@akdcl
Copy link
Member

akdcl commented Aug 27, 2014

Hi, you set dbswf texture scale like this
factory = new StarlingFactory();
//only support scale dbswf texture
factory.scaleForTexture = 2;
factory.parseData();

@SudoPlz
Copy link
Author

SudoPlz commented Aug 27, 2014

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();

@akdcl
Copy link
Member

akdcl commented Aug 28, 2014

you mast get scale ratios youself, and set the scaleForTexture

@SudoPlz
Copy link
Author

SudoPlz commented Aug 28, 2014

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?

@SudoPlz
Copy link
Author

SudoPlz commented Aug 30, 2014

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:
right
but for some reason it looks like this:

wrong
I don't get it... It worked for other animations. Could it be because this one uses a shape tween?

@SudoPlz SudoPlz changed the title Vector to raster in order to (once and for all) get rid of scale problems? Improportionate scale..! (Perhaps vector to raster?) Aug 30, 2014
@SudoPlz
Copy link
Author

SudoPlz commented Aug 30, 2014

This is what my dragonbones generated spritesheet looks like:
mc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants