mirror of
https://github.com/openeggbert/sprite-utils.git
synced 2025-03-25 15:37:50 +01:00
Refactoring IV
This commit is contained in:
parent
675dca59b5
commit
30efc3fe86
@ -29,7 +29,9 @@ import lombok.Data;
|
|||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Represents a sprite sheet and handles parsing from a CSV file.
|
||||||
|
* This class maintains a map of sprite sheet rows and processes each row according to specified rules.
|
||||||
|
*
|
||||||
* @author robertvokac
|
* @author robertvokac
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ -41,13 +43,17 @@ public class SpriteSheet {
|
|||||||
private static int lastWidth = -1;
|
private static int lastWidth = -1;
|
||||||
private static int lastHeight = -1;
|
private static int lastHeight = -1;
|
||||||
private SpriteSheetRow lastSpriteSheetRow = null;
|
private SpriteSheetRow lastSpriteSheetRow = null;
|
||||||
|
/**
|
||||||
|
* Constructor to create a SpriteSheet from a CSV file.
|
||||||
|
*
|
||||||
|
* @param file the CSV file containing sprite sheet data
|
||||||
|
*/
|
||||||
public SpriteSheet(File file) {
|
public SpriteSheet(File file) {
|
||||||
List<SpriteSheetRow> rows = new ArrayList<>();
|
List<SpriteSheetRow> rows = new ArrayList<>();
|
||||||
String text = Utils.readTextFromFile(file);
|
String text = Utils.readTextFromFile(file);
|
||||||
text.lines().skip(1).takeWhile(l -> !l.contains("skipskip"))
|
text.lines().skip(1).takeWhile(line -> !line.contains("skipskip"))
|
||||||
.forEach(l -> {
|
.forEach(line -> {
|
||||||
processLine(l, rows);
|
processLine(line, rows);
|
||||||
});
|
});
|
||||||
saveComputedFile(file, text, rows);
|
saveComputedFile(file, text, rows);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user