diff --git a/assets/graphics/objects.atlas b/assets/graphics/objects.atlas
new file mode 100644
index 0000000..2d96788
--- /dev/null
+++ b/assets/graphics/objects.atlas
@@ -0,0 +1,258 @@
+
+objects.png
+size: 512, 512
+format: RGBA8888
+filter: Nearest, Nearest
+repeat: none
+hero/walk_down
+ rotate: false
+ xy: 2, 410
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 0
+hero/walk_down
+ rotate: false
+ xy: 2, 342
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 1
+hero/walk_down
+ rotate: false
+ xy: 70, 410
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 2
+hero/walk_down
+ rotate: false
+ xy: 2, 274
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 3
+hero/walk_down
+ rotate: false
+ xy: 70, 342
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 4
+hero/walk_down
+ rotate: false
+ xy: 138, 410
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 5
+hero/walk_down
+ rotate: false
+ xy: 2, 206
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 6
+hero/walk_down
+ rotate: false
+ xy: 70, 274
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 7
+hero/walk_down
+ rotate: false
+ xy: 138, 342
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 8
+hero/walk_left
+ rotate: false
+ xy: 206, 410
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 0
+hero/walk_left
+ rotate: false
+ xy: 2, 138
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 1
+hero/walk_left
+ rotate: false
+ xy: 70, 206
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 2
+hero/walk_left
+ rotate: false
+ xy: 138, 274
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 3
+hero/walk_left
+ rotate: false
+ xy: 206, 342
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 4
+hero/walk_left
+ rotate: false
+ xy: 274, 410
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 5
+hero/walk_left
+ rotate: false
+ xy: 2, 70
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 6
+hero/walk_left
+ rotate: false
+ xy: 70, 138
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 7
+hero/walk_left
+ rotate: false
+ xy: 138, 206
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 8
+hero/walk_right
+ rotate: false
+ xy: 206, 274
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 0
+hero/walk_right
+ rotate: false
+ xy: 274, 342
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 1
+hero/walk_right
+ rotate: false
+ xy: 342, 410
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 2
+hero/walk_right
+ rotate: false
+ xy: 2, 2
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 3
+hero/walk_right
+ rotate: false
+ xy: 70, 70
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 4
+hero/walk_right
+ rotate: false
+ xy: 138, 138
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 5
+hero/walk_right
+ rotate: false
+ xy: 206, 206
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 6
+hero/walk_right
+ rotate: false
+ xy: 274, 274
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 7
+hero/walk_right
+ rotate: false
+ xy: 342, 342
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 8
+hero/walk_up
+ rotate: false
+ xy: 410, 410
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 0
+hero/walk_up
+ rotate: false
+ xy: 70, 2
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 1
+hero/walk_up
+ rotate: false
+ xy: 138, 70
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 2
+hero/walk_up
+ rotate: false
+ xy: 206, 138
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 3
+hero/walk_up
+ rotate: false
+ xy: 274, 206
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 4
+hero/walk_up
+ rotate: false
+ xy: 342, 274
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 5
+hero/walk_up
+ rotate: false
+ xy: 410, 342
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 6
+hero/walk_up
+ rotate: false
+ xy: 138, 2
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 7
+hero/walk_up
+ rotate: false
+ xy: 206, 70
+ size: 64, 64
+ orig: 64, 64
+ offset: 0, 0
+ index: 8
diff --git a/assets/graphics/objects.png b/assets/graphics/objects.png
new file mode 100644
index 0000000..3f75834
Binary files /dev/null and b/assets/graphics/objects.png differ
diff --git a/assets/maps/mystic.tiled-session b/assets/maps/mystic.tiled-session
index 62943f5..f99702a 100644
--- a/assets/maps/mystic.tiled-session
+++ b/assets/maps/mystic.tiled-session
@@ -16,6 +16,9 @@
"y": 356.35255088317047
}
},
+ "objects.tsx": {
+ "dynamicWrapping": true
+ },
"tileset.tsx": {
"scaleInDock": 1,
"scaleInEditor": 1
@@ -38,5 +41,6 @@
],
"tileset.lastUsedFormat": "tsx",
"tileset.margin": 4,
- "tileset.spacing": 8
+ "tileset.spacing": 8,
+ "tileset.type": 1
}
diff --git a/assets/maps/objects.tsx b/assets/maps/objects.tsx
new file mode 100644
index 0000000..f58fd62
--- /dev/null
+++ b/assets/maps/objects.tsx
@@ -0,0 +1,2 @@
+
+
diff --git a/assets_raw/hero.png b/assets_raw/hero.png
deleted file mode 100644
index c3c94c1..0000000
Binary files a/assets_raw/hero.png and /dev/null differ
diff --git a/assets_raw/map.png b/assets_raw/map.png
deleted file mode 100644
index 22f07c9..0000000
Binary files a/assets_raw/map.png and /dev/null differ
diff --git a/assets_raw/objects/hero/walk_down_00.png b/assets_raw/objects/hero/walk_down_00.png
new file mode 100644
index 0000000..2e286c0
Binary files /dev/null and b/assets_raw/objects/hero/walk_down_00.png differ
diff --git a/assets_raw/objects/hero/walk_down_01.png b/assets_raw/objects/hero/walk_down_01.png
new file mode 100644
index 0000000..1469ba3
Binary files /dev/null and b/assets_raw/objects/hero/walk_down_01.png differ
diff --git a/assets_raw/objects/hero/walk_down_02.png b/assets_raw/objects/hero/walk_down_02.png
new file mode 100644
index 0000000..2355f24
Binary files /dev/null and b/assets_raw/objects/hero/walk_down_02.png differ
diff --git a/assets_raw/objects/hero/walk_down_03.png b/assets_raw/objects/hero/walk_down_03.png
new file mode 100644
index 0000000..77463ed
Binary files /dev/null and b/assets_raw/objects/hero/walk_down_03.png differ
diff --git a/assets_raw/objects/hero/walk_down_04.png b/assets_raw/objects/hero/walk_down_04.png
new file mode 100644
index 0000000..9ead371
Binary files /dev/null and b/assets_raw/objects/hero/walk_down_04.png differ
diff --git a/assets_raw/objects/hero/walk_down_05.png b/assets_raw/objects/hero/walk_down_05.png
new file mode 100644
index 0000000..e4df681
Binary files /dev/null and b/assets_raw/objects/hero/walk_down_05.png differ
diff --git a/assets_raw/objects/hero/walk_down_06.png b/assets_raw/objects/hero/walk_down_06.png
new file mode 100644
index 0000000..8081c24
Binary files /dev/null and b/assets_raw/objects/hero/walk_down_06.png differ
diff --git a/assets_raw/objects/hero/walk_down_07.png b/assets_raw/objects/hero/walk_down_07.png
new file mode 100644
index 0000000..5deaf98
Binary files /dev/null and b/assets_raw/objects/hero/walk_down_07.png differ
diff --git a/assets_raw/objects/hero/walk_down_08.png b/assets_raw/objects/hero/walk_down_08.png
new file mode 100644
index 0000000..aef2c61
Binary files /dev/null and b/assets_raw/objects/hero/walk_down_08.png differ
diff --git a/assets_raw/objects/hero/walk_left_00.png b/assets_raw/objects/hero/walk_left_00.png
new file mode 100644
index 0000000..4cf5438
Binary files /dev/null and b/assets_raw/objects/hero/walk_left_00.png differ
diff --git a/assets_raw/objects/hero/walk_left_01.png b/assets_raw/objects/hero/walk_left_01.png
new file mode 100644
index 0000000..4842fa8
Binary files /dev/null and b/assets_raw/objects/hero/walk_left_01.png differ
diff --git a/assets_raw/objects/hero/walk_left_02.png b/assets_raw/objects/hero/walk_left_02.png
new file mode 100644
index 0000000..f911c33
Binary files /dev/null and b/assets_raw/objects/hero/walk_left_02.png differ
diff --git a/assets_raw/objects/hero/walk_left_03.png b/assets_raw/objects/hero/walk_left_03.png
new file mode 100644
index 0000000..776b2d3
Binary files /dev/null and b/assets_raw/objects/hero/walk_left_03.png differ
diff --git a/assets_raw/objects/hero/walk_left_04.png b/assets_raw/objects/hero/walk_left_04.png
new file mode 100644
index 0000000..7231451
Binary files /dev/null and b/assets_raw/objects/hero/walk_left_04.png differ
diff --git a/assets_raw/objects/hero/walk_left_05.png b/assets_raw/objects/hero/walk_left_05.png
new file mode 100644
index 0000000..00b3230
Binary files /dev/null and b/assets_raw/objects/hero/walk_left_05.png differ
diff --git a/assets_raw/objects/hero/walk_left_06.png b/assets_raw/objects/hero/walk_left_06.png
new file mode 100644
index 0000000..d10aea7
Binary files /dev/null and b/assets_raw/objects/hero/walk_left_06.png differ
diff --git a/assets_raw/objects/hero/walk_left_07.png b/assets_raw/objects/hero/walk_left_07.png
new file mode 100644
index 0000000..7d70498
Binary files /dev/null and b/assets_raw/objects/hero/walk_left_07.png differ
diff --git a/assets_raw/objects/hero/walk_left_08.png b/assets_raw/objects/hero/walk_left_08.png
new file mode 100644
index 0000000..8e319ff
Binary files /dev/null and b/assets_raw/objects/hero/walk_left_08.png differ
diff --git a/assets_raw/objects/hero/walk_right_00.png b/assets_raw/objects/hero/walk_right_00.png
new file mode 100644
index 0000000..5ac1a70
Binary files /dev/null and b/assets_raw/objects/hero/walk_right_00.png differ
diff --git a/assets_raw/objects/hero/walk_right_01.png b/assets_raw/objects/hero/walk_right_01.png
new file mode 100644
index 0000000..0b1c379
Binary files /dev/null and b/assets_raw/objects/hero/walk_right_01.png differ
diff --git a/assets_raw/objects/hero/walk_right_02.png b/assets_raw/objects/hero/walk_right_02.png
new file mode 100644
index 0000000..1ca522b
Binary files /dev/null and b/assets_raw/objects/hero/walk_right_02.png differ
diff --git a/assets_raw/objects/hero/walk_right_03.png b/assets_raw/objects/hero/walk_right_03.png
new file mode 100644
index 0000000..9b40041
Binary files /dev/null and b/assets_raw/objects/hero/walk_right_03.png differ
diff --git a/assets_raw/objects/hero/walk_right_04.png b/assets_raw/objects/hero/walk_right_04.png
new file mode 100644
index 0000000..6ec37ca
Binary files /dev/null and b/assets_raw/objects/hero/walk_right_04.png differ
diff --git a/assets_raw/objects/hero/walk_right_05.png b/assets_raw/objects/hero/walk_right_05.png
new file mode 100644
index 0000000..19b37f3
Binary files /dev/null and b/assets_raw/objects/hero/walk_right_05.png differ
diff --git a/assets_raw/objects/hero/walk_right_06.png b/assets_raw/objects/hero/walk_right_06.png
new file mode 100644
index 0000000..25f21ef
Binary files /dev/null and b/assets_raw/objects/hero/walk_right_06.png differ
diff --git a/assets_raw/objects/hero/walk_right_07.png b/assets_raw/objects/hero/walk_right_07.png
new file mode 100644
index 0000000..2b3ee6e
Binary files /dev/null and b/assets_raw/objects/hero/walk_right_07.png differ
diff --git a/assets_raw/objects/hero/walk_right_08.png b/assets_raw/objects/hero/walk_right_08.png
new file mode 100644
index 0000000..7b20f57
Binary files /dev/null and b/assets_raw/objects/hero/walk_right_08.png differ
diff --git a/assets_raw/objects/hero/walk_up_00.png b/assets_raw/objects/hero/walk_up_00.png
new file mode 100644
index 0000000..b5679ee
Binary files /dev/null and b/assets_raw/objects/hero/walk_up_00.png differ
diff --git a/assets_raw/objects/hero/walk_up_01.png b/assets_raw/objects/hero/walk_up_01.png
new file mode 100644
index 0000000..cdaf4b6
Binary files /dev/null and b/assets_raw/objects/hero/walk_up_01.png differ
diff --git a/assets_raw/objects/hero/walk_up_02.png b/assets_raw/objects/hero/walk_up_02.png
new file mode 100644
index 0000000..11e8727
Binary files /dev/null and b/assets_raw/objects/hero/walk_up_02.png differ
diff --git a/assets_raw/objects/hero/walk_up_03.png b/assets_raw/objects/hero/walk_up_03.png
new file mode 100644
index 0000000..d70309c
Binary files /dev/null and b/assets_raw/objects/hero/walk_up_03.png differ
diff --git a/assets_raw/objects/hero/walk_up_04.png b/assets_raw/objects/hero/walk_up_04.png
new file mode 100644
index 0000000..77172fd
Binary files /dev/null and b/assets_raw/objects/hero/walk_up_04.png differ
diff --git a/assets_raw/objects/hero/walk_up_05.png b/assets_raw/objects/hero/walk_up_05.png
new file mode 100644
index 0000000..7acd4c8
Binary files /dev/null and b/assets_raw/objects/hero/walk_up_05.png differ
diff --git a/assets_raw/objects/hero/walk_up_06.png b/assets_raw/objects/hero/walk_up_06.png
new file mode 100644
index 0000000..af07b62
Binary files /dev/null and b/assets_raw/objects/hero/walk_up_06.png differ
diff --git a/assets_raw/objects/hero/walk_up_07.png b/assets_raw/objects/hero/walk_up_07.png
new file mode 100644
index 0000000..50f72de
Binary files /dev/null and b/assets_raw/objects/hero/walk_up_07.png differ
diff --git a/assets_raw/objects/hero/walk_up_08.png b/assets_raw/objects/hero/walk_up_08.png
new file mode 100644
index 0000000..7776436
Binary files /dev/null and b/assets_raw/objects/hero/walk_up_08.png differ
diff --git a/assets_raw/objects/pack.json b/assets_raw/objects/pack.json
new file mode 100644
index 0000000..763069d
--- /dev/null
+++ b/assets_raw/objects/pack.json
@@ -0,0 +1,36 @@
+{
+ "pot": true,
+ "paddingX": 4,
+ "paddingY": 4,
+ "bleed": true,
+ "edgePadding": true,
+ "duplicatePadding": true,
+ "rotation": false,
+ "minWidth": 16,
+ "minHeight": 16,
+ "maxWidth": 512,
+ "maxHeight": 512,
+ "square": false,
+ "stripWhitespaceX": false,
+ "stripWhitespaceY": false,
+ "alphaThreshold": 0,
+ "filterMin": "Nearest",
+ "filterMag": "Nearest",
+ "wrapX": "ClampToEdge",
+ "wrapY": "ClampToEdge",
+ "format": "RGBA8888",
+ "alias": false,
+ "outputFormat": "png",
+ "jpegQuality": 0.9,
+ "ignoreBlankImages": true,
+ "fast": false,
+ "debug": false,
+ "combineSubdirectories": true,
+ "flattenPaths": false,
+ "premultiplyAlpha": false,
+ "useIndexes": true,
+ "limitMemory": true,
+ "grid": false,
+ "scale": [1],
+ "scaleSuffix": [""]
+}
diff --git a/core/src/main/java/io/github/com/quillraven/component/Graphic.java b/core/src/main/java/io/github/com/quillraven/component/Graphic.java
index 5abb29b..d73fbc3 100644
--- a/core/src/main/java/io/github/com/quillraven/component/Graphic.java
+++ b/core/src/main/java/io/github/com/quillraven/component/Graphic.java
@@ -9,9 +9,9 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
* Component that stores the visual representation of an entity.
* Contains a texture region and a color for tinting.
*/
-public class Graphic implements Component {
+public record Graphic(
+ TextureRegion region,
+ Color color
+) implements Component {
public static final ComponentMapper MAPPER = ComponentMapper.getFor(Graphic.class);
-
- public TextureRegion region;
- public final Color color = new Color(Color.WHITE);
}
diff --git a/core/src/main/java/io/github/com/quillraven/component/Transform.java b/core/src/main/java/io/github/com/quillraven/component/Transform.java
index 68fd31f..17026e9 100644
--- a/core/src/main/java/io/github/com/quillraven/component/Transform.java
+++ b/core/src/main/java/io/github/com/quillraven/component/Transform.java
@@ -8,13 +8,13 @@ import com.badlogic.gdx.math.Vector2;
* Component that stores the position, z-index, and size of an entity.
* Implements Comparable to allow sorting entities by z-index and position.
*/
-public class Transform implements Component, Comparable {
+public record Transform(
+ Vector2 position,
+ int z,
+ Vector2 size
+) implements Component, Comparable {
public static final ComponentMapper MAPPER = ComponentMapper.getFor(Transform.class);
- public final Vector2 position = new Vector2();
- public int z = 0;
- public final Vector2 size = new Vector2(1f, 1f);
-
@Override
public int compareTo(Transform other) {
if (this.z != other.z) {
diff --git a/core/src/main/java/io/github/com/quillraven/system/RenderSystem.java b/core/src/main/java/io/github/com/quillraven/system/RenderSystem.java
index eec17df..d4cb042 100644
--- a/core/src/main/java/io/github/com/quillraven/system/RenderSystem.java
+++ b/core/src/main/java/io/github/com/quillraven/system/RenderSystem.java
@@ -74,16 +74,16 @@ public class RenderSystem extends SortedIteratingSystem implements Disposable {
protected void processEntity(Entity entity, float deltaTime) {
Transform transform = Transform.MAPPER.get(entity);
Graphic graphic = Graphic.MAPPER.get(entity);
- if (graphic.region == null) {
+ if (graphic.region() == null) {
return;
}
- batch.setColor(graphic.color);
+ batch.setColor(graphic.color());
batch.draw(
- graphic.region,
- transform.position.x, transform.position.y,
- transform.size.x / 2, transform.size.y / 2,
- transform.size.x, transform.size.y,
+ graphic.region(),
+ transform.position().x, transform.position().y,
+ transform.size().x / 2, transform.size().y / 2,
+ transform.size().x, transform.size().y,
1, 1,
0
);
diff --git a/util/src/main/java/io/github/com/quillraven/util/TexturePackerTool.java b/util/src/main/java/io/github/com/quillraven/util/TexturePackerTool.java
index 08aa9f6..53dd5c2 100644
--- a/util/src/main/java/io/github/com/quillraven/util/TexturePackerTool.java
+++ b/util/src/main/java/io/github/com/quillraven/util/TexturePackerTool.java
@@ -1,20 +1,29 @@
package io.github.com.quillraven.util;
import com.badlogic.gdx.tools.texturepacker.TexturePacker;
-import java.io.File;
-/**
- * Utility class to execute LibGDX's TextureAtlas packer tool.
- * This tool packs multiple images into a single texture atlas.
- */
public class TexturePackerTool {
public static void main(String[] args) {
+ // packMap();
+ packObjects();
+ System.out.println("Texture packing completed successfully!");
+ }
+
+ private static void packObjects() {
+ String inputDir = "assets_raw/objects";
+ String outputDir = "assets/graphics";
+ String packFileName = "objects";
+
+ System.out.println("Packing textures from " + inputDir + " to " + outputDir + "/" + packFileName);
+ TexturePacker.process(inputDir, outputDir, packFileName);
+ }
+
+ private static void packMap() {
String inputDir = "assets_raw/map";
String outputDir = "assets/maps";
String packFileName = "tileset";
System.out.println("Packing textures from " + inputDir + " to " + outputDir + "/" + packFileName);
TexturePacker.process(inputDir, outputDir, packFileName);
- System.out.println("Texture packing completed successfully!");
}
}