Author:
kutucuk (posted
2013-05-12 09:36:09 , viewed 795 times)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public class Atlas {
private static TextureAtlas atlas ;
private static PixmapPacker packer = new PixmapPacker (512 , 512 , Format .RGBA8888 , 0 , false );
private static final HashMap <String , AtlasRegion > regions = new HashMap <String , AtlasRegion >();
public static void generateAtlas () {
packer .pack ("tank" , new Pixmap (Gdx .files .internal ("images/tank.png" )));
packer .pack ("cannonball" , new Pixmap (Gdx .files .internal ("images/cannonball.png" )));
packer .pack ("explosion" , new Pixmap (Gdx .files .internal ("images/explosion.png" )));
atlas = packer .generateTextureAtlas (TextureFilter .Nearest , TextureFilter .Nearest , true );
for (AtlasRegion r : atlas .getRegions ()) regions .put (r .name , r );
}
public static void dispose () {
atlas .dispose ();
packer .dispose ();
}
public static AtlasRegion get (String name ) {
return regions .get (name );
}
}
Special syntax:
To highlight a line (yellow background), prefix it with '@@'
To indicate that a line should be removed (red background), prefix it with '-'
To indicate that a line should be added (green background), prefix it with '+'
To post multiple snippets, seperate them by '~~~~'
ivj94
(583 views)
2018-03-24 14:47:39
ivj94
(47 views)
2018-03-24 14:46:31
ivj94
(374 views)
2018-03-24 14:43:53
Solater
(61 views)
2018-03-17 05:04:08
nelsongames
(108 views)
2018-03-05 17:56:34
Gornova
(150 views)
2018-03-02 22:15:33
buddyBro
(693 views)
2018-02-28 16:59:18
buddyBro
(91 views)
2018-02-28 16:45:17
xxMrPHDxx
(493 views)
2017-12-31 17:17:51
xxMrPHDxx
(732 views)
2017-12-31 17:15:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org