4
4
5
5
import com .google .inject .Inject ;
6
6
7
- public class SpriteSheetLoader {
7
+ public class SpriteSheetSplitter {
8
8
private String name ;
9
9
private String sourceImage ;
10
10
private Integer width ;
@@ -17,7 +17,7 @@ public class SpriteSheetLoader {
17
17
private final GraphicEntityModule graphicEntityModule ;
18
18
19
19
@ Inject
20
- public SpriteSheetLoader (GraphicEntityModule graphicEntityModule ) {
20
+ public SpriteSheetSplitter (GraphicEntityModule graphicEntityModule ) {
21
21
this .graphicEntityModule = graphicEntityModule ;
22
22
}
23
23
@@ -53,51 +53,51 @@ public int getImagesPerRow() {
53
53
return imagesPerRow ;
54
54
}
55
55
56
- public SpriteSheetLoader setName (String name ) {
56
+ public SpriteSheetSplitter setName (String name ) {
57
57
this .name = name ;
58
58
return this ;
59
59
}
60
60
61
- public SpriteSheetLoader setSourceImage (String sourceImage ) {
61
+ public SpriteSheetSplitter setSourceImage (String sourceImage ) {
62
62
this .sourceImage = sourceImage ;
63
63
return this ;
64
64
}
65
65
66
- public SpriteSheetLoader setWidth (int width ) {
66
+ public SpriteSheetSplitter setWidth (int width ) {
67
67
this .width = width ;
68
68
return this ;
69
69
}
70
70
71
- public SpriteSheetLoader setHeight (int height ) {
71
+ public SpriteSheetSplitter setHeight (int height ) {
72
72
this .height = height ;
73
73
return this ;
74
74
}
75
75
76
- public SpriteSheetLoader setOrigRow (int origRow ) {
76
+ public SpriteSheetSplitter setOrigRow (int origRow ) {
77
77
this .origRow = origRow ;
78
78
return this ;
79
79
}
80
80
81
- public SpriteSheetLoader setOrigCol (int origCol ) {
81
+ public SpriteSheetSplitter setOrigCol (int origCol ) {
82
82
this .origCol = origCol ;
83
83
return this ;
84
84
}
85
85
86
- public SpriteSheetLoader setImageCount (int imageCount ) {
86
+ public SpriteSheetSplitter setImageCount (int imageCount ) {
87
87
this .imageCount = imageCount ;
88
88
return this ;
89
89
}
90
90
91
- public SpriteSheetLoader setImagesPerRow (int imagesPerRow ) {
91
+ public SpriteSheetSplitter setImagesPerRow (int imagesPerRow ) {
92
92
this .imagesPerRow = imagesPerRow ;
93
93
return this ;
94
94
}
95
95
96
96
/**
97
- * Load a spritesheet (all fields are required except imagesPerRow). Returns an array of image names that can be used in Sprite or SpriteAnimation.
97
+ * Splits up a spritesheet (all fields are required except imagesPerRow). Returns an array of image names that can be used in Sprite or SpriteAnimation.
98
98
* @return an array of image names.
99
99
*/
100
- public String [] load () {
100
+ public String [] split () {
101
101
if (name == null ) {
102
102
throw new IllegalStateException ("invalid name" );
103
103
}
@@ -120,7 +120,7 @@ public String[] load() {
120
120
throw new IllegalStateException ("invalid origCol" );
121
121
}
122
122
123
- graphicEntityModule .loadSpriteSheet (this );
123
+ graphicEntityModule .loadSpriteSheetSplitter (this );
124
124
if (imageCount > 1 ) {
125
125
return IntStream .range (0 , imageCount ).mapToObj (i -> name + i ).toArray (String []::new );
126
126
} else {
0 commit comments