
TextureRegion.getV2() + (textureRegion.getV() - textureRegion. Position.y + height*(1 - portionToDraw) , Vector2 position, float width, float height, float portionToDraw) SpriteBatch batcher, TextureRegion textureRegion, So I figured out another solution: public static void I really don't know why, but the other answers didn't help me in my case.
GDX TEXTUREPACKER ANDROID
NOTE: The Texture Atlas MUST be placed in android asset file (if android version is being used as Android requires assets to be within application structure so reference can be generate for the R file. Height / 2, /* draw the sprite at half height*/įrame.getRegionHeight() / 2, /* only use the texture data from the top of the sprite */Īfter much struggle, I finally found a way to draw texture portions. Textures Atlas (Sprite Sheet) Is a file containing images that are loaded into memory for performance. Y + (height / 2), /* reposition to draw from half way up from the original sprite position */ To only draw the top half of a sprite (as if the sprite was standing in a liquid, for example) you would set the height, the texture region height, and include a slight adjustment to the draw position: spriteBatch.draw( X, y, width and height are the same as you would use in spriteBatch.draw(frame, x, y, width, height) Where spriteBatch is the SpriteBatch and frame is a Sprite * We only want to use half the source texture region */įrame.getRegionWidth() / 2, /* srcWidth the source with in texels */įrame.getRegionHeight(), /* srcHeight the source height in texels */įalse, /* flipX whether to flip the sprite horizontally */įalse) /* flipY whether to flip the sprite vertically */ Height, /* height the height in pixels */įrame.getScaleX(), /* scaleX the scale of the rectangle around originX/originY in x */įrame.getScaleY(), /* scaleY the scale of the rectangle around originX/originY in y */Ġ, /* rotation the angle of counter clockwise rotation of the rectangle around originX/originY */įrame.getRegionX(), /* srcX the x-coordinate in texel space */įrame.getRegionY(), /* srcY the y-coordinate in texel space */ Width / 2, /* width the width in pixels */ * We only want to draw half the width of the sprite */ Moving the texturePacker task to adle in the desktop project produces the same error. Height / 2, /* originY the y-coordinate of the scaling and rotation origin relative to the screen space coordinates */ Width / 2, /* originX the x-coordinate of the scaling and rotation origin relative to the screen space coordinates */ Y, /* y the y-coordinate in screen space */ X, /* x the x-coordinate in screen space */
GDX TEXTUREPACKER CODE
getTexture() function.įor example, the following code could be used to draw only the left side of a sprite: spriteBatch.draw( background, characters, impact objects and so on. Sort sprites to multiple texture atlases: Have different sprite sheets for different categories, e.g. If you have a Sprite that you are already drawing, you can get the Texture itself from the Sprite using the. Distribute sprites across multiple sheets: TexturePacker creates multiple image and data files if not all sprites could be packed into a single texture. As long as you only intend to draw a rectangular sub-section of that sprite. MainClassName = project.hasProperty("mainClass") ? project.It's quite possible to partially draw a sprite using the SpriteBatch.draw( Texture.) rather than the SpriteBatch.draw( TextureRegion.). Atlas importer plugin for other texture pack tools Load packed atlas texture to filesystem and can be used in godot. There is no direct equivalent to mvn exec:java in gradle, you need to either apply the application plugin or have a JavaExec task. How do I specify the input and output directories and the atlas file when running this with gradle? (Assuming the first two questions are solved.) How do I solve the dependency issue and the unable to resolve class. Where is the correct place for the texturePacker task? Which adle do I put this in? When I do so, I still get the same error. According to, I also need to add compile ":gdx-tools:$gdxVersion" to the root adle under the desktop project's dependencies. Moving the texturePacker task to adle in the desktop project produces the same error. Unable to resolve class .texturepacker.TexturePacker TexturePacker.process(texturePacker, texturePacker, texturePacker)

(Note that I am using Android Studio and its directory structure rather than Eclipse.) I first added the following to the Android Studio project's adle: import .texturepacker.TexturePacker

I am attempting to create a gradle task which runs TexturePacker according to the instructions here.
