Hi.
This is a simple class compiled to library for using atlas pictures made for libgdx with
libgdx-texturepacker-gui out of libgdx.
For example, you have packed some texture like in "atlas.pack" and "atlas.png" and you want to use it with
GameView, GameSpriteView, AcceleratedSurface or anything that use bitmap object.
This library will let you do that, see the attached example.
TextureAtlas
Author: Jaames
Version: 1
How to use it:
Decompress TextureAtlas.jar and TextureAtlas.xml from library.zp file and put it in your "Additional libraries" folder.
Decompress example.zip somewhere on your computer, run the project and have a fun
Example :
https://dl.dropboxusercontent.com/u/40815149/Example.zip
Cheers!
This is a simple class compiled to library for using atlas pictures made for libgdx with
libgdx-texturepacker-gui out of libgdx.
For example, you have packed some texture like in "atlas.pack" and "atlas.png" and you want to use it with
GameView, GameSpriteView, AcceleratedSurface or anything that use bitmap object.
This library will let you do that, see the attached example.
TextureAtlas
Author: Jaames
Version: 1
- TextureAtlas
Fields:- AtlasPicture As String
- Pictures As List
- IsInitialized As Boolean
Tests whether the object has been initialized. - Class_GlobalsAs String
- GetNumOfAtlasMainPictures (packFile As String) As List
Returns number of main atlas pictures from the atlas pack file - GetPictureByIndex (Name As String, Index As String) As Bitmap
This method will search for picture based on it's name and it's index (if you have multiple bitmaps with the same name inside the atlas)
Example code: (search for bitmap "bird" with the index of 2 )
B4X:Dim bird as bitmap = Atlas.GetPictureByIndex("bird","2")
- GetPictureByName (Name As String) As Bitmap
This method will search for picture and return the bitmap object
Example code: (search for bird.png but you call it without .png)
B4X:Dim bird as bitmap = Atlas.GetPictureByName("bird")
- Initialize (packFile As String) As String
Initializes the object.
You should put your atlas.pack and png file in dir assets
Example code:
B4X:Dim Atlas as TextureAtlas Atlas.Initialise("atlas.pack")
How to use it:
Decompress TextureAtlas.jar and TextureAtlas.xml from library.zp file and put it in your "Additional libraries" folder.
Decompress example.zip somewhere on your computer, run the project and have a fun
Example :
https://dl.dropboxusercontent.com/u/40815149/Example.zip
Cheers!