Jar Files & Maven
The Maven dependency is hosted off of JitPack, so you will need to add JitPack as a repository before you add V2DSprite as a dependency.
Maven
JitPack:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>Dependency:
<dependency>
<groupId>com.github.Valkryst</groupId>
<artifactId>V2DSprite</artifactId>
<version>2020.04.05-break</version>
</dependency>Jar
Jar files can be found on the releases page.
Loading a SpriteSheet
To load a SpriteSheet from the filesystem, you could use the following code.
final Path imagePath = Paths.get("./test_res/image.png");
final Path jsonPath = Paths.get("./test_res/data-valid.json");
final SpriteSheet spriteSheet = new SpriteSheet(imagePath, jsonPath);To load a SpriteSheet from within the JAR, you can use the following code.
final Path imagePath = Paths.get(ClassName.class.getResource("./image.png").toURI());
final Path jsonPath = Paths.get(ClassName.class.getResource("./data-valid.png").toURI());
final SpriteSheet spriteSheet = new SpriteSheet(imagePath, jsonPath);Defining a SpriteSheet
The Sprites of a SpriteSheet are defined VIA an array of JSON objects.
- name - A unique ID for the sprite.
- Capital letters are ignored, so the words "Yellow", "YeLLoW", and "yellow" are all considered to be the same.
- x - The x-axis position of the Sprite's top-left pixel, within the SpriteSheet.
- y - The y-axis position of the Sprite's top-left pixel, within the SpriteSheet.
- width - The width of the Sprite, in pixels.
- height - The height of the Sprite, in pixels.
[
{
"name": "Sprite A",
"x": 0,
"y": 0,
"width": 32,
"height": 32
},
{
"name": "Sprite B",
"x": 32,
"y": 0,
"width": 32,
"height": 32
},
{
"name": "Sprite C",
"x": 0,
"y": 32,
"width": 32,
"height": 32
},
{
"name": "SpriteD",
"x": 32,
"y": 32,
"width": 32,
"height": 32
}
]
Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
