![]() ![]() You can look up mip mapping to see why this is the case. ![]() Otherwise, performance will suffer when sprites are drawn smaller than their native resolution, and may look distorted as you described. Your min filter should be MipMapLinearLinear or MipMapLinearNearest. Polygon The polygon algorithm removes transparent parts of the sprites to pack them even tighter. Your game engine must be able to import packing information files which most game engines do. For now it can just be 100, but if you decide to make some smaller resolution art later, you can adjust it accordingly then without having to find all the occurrences of 100 in your code. MaxRects This algorithm minimizes the sprite sheet size by placing sprites in gaps between other sprites. Make pixelsPerMeter a variable that is set once when the game starts up. It may be fine during development, but down the road you will probably want to have two or three different smaller resolution versions that you can selectively load.įor this reason, I also would avoid hard-coding that 100 everywhere in your code. This will use a lot of memory and inflate load times. If you do this, you will have to load very high resolution images on devices that can't take advantage of them. "I should have one set of images for the highest resolution" This is not necessarily true. MCamera.viewportWidth = 25.6f / (float)() * (float)() MCamera.viewportHeight = 25.6f //game screen always 25.6 meters tall It's better to pick a constant height or width (choose based on the type of game you're making) and adjust the opposite dimension based on the aspect ratio of the current screen. You have one error in setting up your camera: You assume that the screen is always the same aspect ratio, but in reality it will vary. I've test it on real devices with several resolutions and it looks perfect. Regarding (3), the problem is with Genymotion :(, its pixelating the game. Is the distortion means that my code is really scaling down the sprite and somehow libgdx has scaled it up again and damaged the quality?.Am I correct having only the highest quality images?.Is this the best practice or should I work differently?.BUT, they are distorted as hell! a perfectly round image looks pixelated on the edges and not round. This works and the images are displayed as intended. tSize(mImage.getWidth() / 100, mImage.getHeight() / 100) Now, that means I should draw my sprites with a 1/100 size, which i'm doing here: TextureAtlas atlas = new TextureAtlas(("images/pack.atlas")) (mCamera.viewportWidth / 2, mCamera.viewportHeight / 2, 0f) Īs you can see I chose to work with 1 meter = 100 pixels. From Screen's C'TOR: mCamera = new OrthographicCamera() I've set my camera, as recommended in several SO's, to fixed meters and avoid all the PPM stuff. TexturePacker.process(settings, inputDir, outputDir, packFileName) I'm using TexturePacker to pack my images and even using linear linear to get max quality: TexturePacker.Settings settings = new TexturePacker.Settings() I realize I should have one set of images, for the highest resolution 2560x1440 (For preventing ugly scaling up not vector images). ![]() After reading A LOT, there is still one thing I don't understand. I use the cocos2d version 3.5.I'm an android developer, building my first game using LibGDX. I read many articles about the advantages of using pvr.ccz. In TexturePacker I have the following options selected: But somehow the sprite (play-button.png) is first of all blurry and on the second hand it's the wrong position on the spritesheet (so it's a half of another sprite and not the playbutton). ![]() Return spritesheet is loaded and I don't get any warnings or errors in the console. Sprite.positionType = CCPositionTypeNormalized * sprite = [CCSprite spriteWithSpriteFrame:[CCSpriteFrame = ccp(0.5, 0.5) Apple recommend assigning self with supers return value It's loaded like in my example code below. I have a simple spritesheet with a few sprites on it created by TexturePacker. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |