java - TexturePacking with Libgdx - -


My program packs a series of images and outputs them in an aste.png, and an aste.atlas. My code for packing is as follows:

  Public Zero Pack () {System.out.println ("Packing should not normally be called! If you had no clear intention of packing, Please check image Atlas constructor. "); Settings settings = new settings (); Settings.maxWidth = 512; Settings.maxHeight = 512; TexturePacker2.process (Settings, "E: Files / Eclipse / Projects / Starfolders / Starfolders - Android / Property / Practice /": Name: "/ Files / Eclipse Project / Starfolder / Starfolder-Android / Property / Practice /", name .substring (0,4)); }   

I do not need to pack every time to run the program, that's why I can participate with the full file path (I will only pack after running on the desktop And added new images), however, I've only used the full file path because I do not know how to do this otherwise. I am using the Android Assets folder. (Desktop is connected to the Android Asset folder) As I am running it from the desktop version, it is trying to get the desktop path, when I need to use the path of the property, which is for me Gdx.file (This problem is not required for the function of my program)

Once I've packed these images which I do:

  atlas = new textureAtlas ( Gdx.files Internal ("Sprite / aste.atlas")); Public texture gettex (string ignition) {return atlas.findRegion (imgname) .getttexture (); }   

When I try and getTex ();

The following images are in my asset / sprites / asteroids directory: big_a1 I pass in "sma_a2" as imdname Png big_a2.png med_a1.png med_a2.png sma_a1.png sma_a2.png Everyone was successfully packaged in aste.png and aste.atlas

My problem is, it does not matter that the image Whatever I pass in I have a complete aste.png

I was curious as to why I would use a pack instead of images, as I started with images, and then They packed them, only to get images.



phone getTexture () TextureRegion Returned by findRegion on .

The whole state of the atlas is that there are "similar" textures in the but on different areas within that texture In this way you can "bind" a big texture in OpenGL (which is expensive) and then present many different pieces in texture.

Most other APIs in Libgdx that should also work with a texture with the Texture Regions .

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -