diff --git a/pom.xml b/pom.xml index 75d556b..8915099 100644 --- a/pom.xml +++ b/pom.xml @@ -3,18 +3,18 @@ sprite-utils: Tool used to work with sprites Copyright (C) 2024-2024 the original author or authors. - This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; version 2 - of the License only. - + as published by the Free Software Foundation, either version 3 + of the License, or (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software + along with this program. If not, see + or write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --> or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/org/nanoboot/spriteutils/commands/DrawCommand.java b/src/main/java/org/nanoboot/spriteutils/commands/DrawCommand.java index cb46e65..b39f09e 100644 --- a/src/main/java/org/nanoboot/spriteutils/commands/DrawCommand.java +++ b/src/main/java/org/nanoboot/spriteutils/commands/DrawCommand.java @@ -1,19 +1,20 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // sprite-utils: Tool used to work with sprites -// Copyright (C) 2023-2023 the original author or authors. +// Copyright (C) 2024 the original author or authors. // -// This program is free software; you can redistribute it and/or +// This program is free software: you can redistribute it and/or // modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 -// of the License only. +// as published by the Free Software Foundation, either version 3 +// of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software +// along with this program. If not, see +// or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// package org.nanoboot.spriteutils.commands; @@ -66,8 +67,8 @@ public class DrawCommand implements Command { @Override public String run(SpriteUtilsArgs bitBackupArgs) { - File workingDirectory = new File("/home/robertvokac/Desktop/speedy_eggbert/speedy_eggbert_I/IMAGE08"); - File testFile = new File(workingDirectory, "blupi000.blp"); + File workingDirectory = new File("/rv/data/desktop/code/code.nanoboot.org/nanoboot/open-eggbert-data/Speedy_Eggbert_1/Game/IMAGE08"); + File testFile = new File(workingDirectory, "BLUPI000.BLP"); File backupFile = new File(testFile.getAbsolutePath() + ".backup"); if (backupFile.exists()) { testFile.delete(); @@ -97,11 +98,11 @@ public class DrawCommand implements Command { g.setStroke(dashedStroke); //g.drawRect(0,0, 28,19); SpriteSheet spriteSheet = new SpriteSheet(new File(workingDirectory, "spritesheet.csv")); - spriteSheet.getSpriteSheets(testFile.getName()).forEach(r -> { + spriteSheet.getSpriteSheets(testFile.getName().toLowerCase()).forEach(r -> { int startX = r.getX(); - int endX = startX + r.getWidth(); + int endX = startX + r.getWidth() -1; int startY = r.getY(); - int endY = startY + r.getHeight(); + int endY = startY + r.getHeight() - 1; drawNumber(r.getNumberPerSheet(), g, endX - 2, endY - 1); // @@ -128,7 +129,7 @@ public class DrawCommand implements Command { g.setStroke(dashedStroke); - g.drawRect(r.getX(), r.getY(), r.getWidth(), r.getHeight()); + g.drawRect(r.getX(), r.getY(), r.getWidth() -1, r.getHeight() -1); }); // for (int i = 0; i <= 100; i++) { // g.setStroke(new BasicStroke(random.apply(1,3))); @@ -260,7 +261,7 @@ public class DrawCommand implements Command { true, false, true, true, true, true, false, false, true, - false, false, true}; + true, true, true}; private static void drawANumber(int number, Graphics2D g, int endX, int endY) { System.out.println("drawNumber " +number + " " + endX + " " + endY); @@ -324,7 +325,7 @@ Point p = start; BiConsumer drawPixel = (x, y) -> { - System.out.println("Drawing pixel: " + x + " " + y); + //System.out.println("Drawing pixel: " + x + " " + y); //g.setColor(Color.ORANGE); g.fillRect(start.x + x, start.y + y, 1, 1); //g.drawLine(start.x + x, start.y + y, start.x + x, start.y + y); diff --git a/src/main/java/org/nanoboot/spriteutils/commands/HelpCommand.java b/src/main/java/org/nanoboot/spriteutils/commands/HelpCommand.java index 531229f..c62ee13 100644 --- a/src/main/java/org/nanoboot/spriteutils/commands/HelpCommand.java +++ b/src/main/java/org/nanoboot/spriteutils/commands/HelpCommand.java @@ -1,19 +1,20 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // sprite-utils: Tool used to work with sprites -// Copyright (C) 2023-2023 the original author or authors. +// Copyright (C) 2024 the original author or authors. // -// This program is free software; you can redistribute it and/or +// This program is free software: you can redistribute it and/or // modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 -// of the License only. +// as published by the Free Software Foundation, either version 3 +// of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software +// along with this program. If not, see +// or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// package org.nanoboot.spriteutils.commands; diff --git a/src/main/java/org/nanoboot/spriteutils/commands/VersionCommand.java b/src/main/java/org/nanoboot/spriteutils/commands/VersionCommand.java index d4b4419..382e702 100644 --- a/src/main/java/org/nanoboot/spriteutils/commands/VersionCommand.java +++ b/src/main/java/org/nanoboot/spriteutils/commands/VersionCommand.java @@ -1,19 +1,20 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // sprite-utils: Tool used to work with sprites -// Copyright (C) 2023-2023 the original author or authors. +// Copyright (C) 2024 the original author or authors. // -// This program is free software; you can redistribute it and/or +// This program is free software: you can redistribute it and/or // modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 -// of the License only. +// as published by the Free Software Foundation, either version 3 +// of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software +// along with this program. If not, see +// or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/org/nanoboot/spriteutils/core/Command.java b/src/main/java/org/nanoboot/spriteutils/core/Command.java index 8b5a47c..be59b83 100644 --- a/src/main/java/org/nanoboot/spriteutils/core/Command.java +++ b/src/main/java/org/nanoboot/spriteutils/core/Command.java @@ -1,19 +1,20 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // sprite-utils: Tool used to work with sprites -// Copyright (C) 2023-2023 the original author or authors. +// Copyright (C) 2024 the original author or authors. // -// This program is free software; you can redistribute it and/or +// This program is free software: you can redistribute it and/or // modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 -// of the License only. +// as published by the Free Software Foundation, either version 3 +// of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software +// along with this program. If not, see +// or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/org/nanoboot/spriteutils/core/Main.java b/src/main/java/org/nanoboot/spriteutils/core/Main.java index 4b31d31..e7e5394 100755 --- a/src/main/java/org/nanoboot/spriteutils/core/Main.java +++ b/src/main/java/org/nanoboot/spriteutils/core/Main.java @@ -1,19 +1,20 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // sprite-utils: Tool used to work with sprites -// Copyright (C) 2023-2023 the original author or authors. +// Copyright (C) 2024 the original author or authors. // -// This program is free software; you can redistribute it and/or +// This program is free software: you can redistribute it and/or // modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 -// of the License only. +// as published by the Free Software Foundation, either version 3 +// of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software +// along with this program. If not, see +// or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// package org.nanoboot.spriteutils.core; diff --git a/src/main/java/org/nanoboot/spriteutils/core/SpriteSheet.java b/src/main/java/org/nanoboot/spriteutils/core/SpriteSheet.java index c7332fd..8ea2e23 100644 --- a/src/main/java/org/nanoboot/spriteutils/core/SpriteSheet.java +++ b/src/main/java/org/nanoboot/spriteutils/core/SpriteSheet.java @@ -29,7 +29,8 @@ public class SpriteSheet { public SpriteSheet(File file) { List rows = new ArrayList<>(); String text = Utils.readTextFromFile(file); - text.lines().skip(1).forEach(l -> { + text.lines().skip(1).takeWhile(l->!l.contains("skipskip")) + .forEach(l -> { final SpriteSheetRow spriteSheetRow = new SpriteSheetRow(l); if (lastSpriteSheetRow != null) { @@ -52,7 +53,7 @@ public class SpriteSheet { spriteSheetRow.numberPerSheet = lastSpriteSheetRow.numberPerSheet + 1; if(spriteSheetRow.row > lastSpriteSheetRow.row) { - if(spriteSheetRow.row != lastSpriteSheetRow.row) { + if(spriteSheetRow.row != (lastSpriteSheetRow.row + 1)) { throw new SpriteUtilsException("Unexpected row for " + spriteSheetRow.createId()); } } @@ -77,7 +78,7 @@ public class SpriteSheet { if (lastX == -1) { throw new SpriteUtilsException("Could not compute X for " + spriteSheetRow.createId()); } else { - spriteSheetRow.x = lastX + lastWidth + 1; + spriteSheetRow.x = lastX + lastWidth; } } } diff --git a/src/main/java/org/nanoboot/spriteutils/core/SpriteSheetRow.java b/src/main/java/org/nanoboot/spriteutils/core/SpriteSheetRow.java index 7d8167d..b413496 100644 --- a/src/main/java/org/nanoboot/spriteutils/core/SpriteSheetRow.java +++ b/src/main/java/org/nanoboot/spriteutils/core/SpriteSheetRow.java @@ -1,7 +1,22 @@ -/* - * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license - * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template - */ +/////////////////////////////////////////////////////////////////////////////////////////////// +// sprite-utils: Tool used to work with sprites +// Copyright (C) 2024 the original author or authors. +// +// This program is free software: you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation, either version 3 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see +// or write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +/////////////////////////////////////////////////////////////////////////////////////////////// package org.nanoboot.spriteutils.core; import java.util.Arrays; diff --git a/src/main/java/org/nanoboot/spriteutils/core/SpriteUtils.java b/src/main/java/org/nanoboot/spriteutils/core/SpriteUtils.java index e6d3332..44d320f 100644 --- a/src/main/java/org/nanoboot/spriteutils/core/SpriteUtils.java +++ b/src/main/java/org/nanoboot/spriteutils/core/SpriteUtils.java @@ -1,19 +1,20 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // sprite-utils: Tool used to work with sprites -// Copyright (C) 2023-2023 the original author or authors. +// Copyright (C) 2024 the original author or authors. // -// This program is free software; you can redistribute it and/or +// This program is free software: you can redistribute it and/or // modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 -// of the License only. +// as published by the Free Software Foundation, either version 3 +// of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software +// along with this program. If not, see +// or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/org/nanoboot/spriteutils/core/SpriteUtilsArgs.java b/src/main/java/org/nanoboot/spriteutils/core/SpriteUtilsArgs.java index 31bb87a..73cbcb9 100644 --- a/src/main/java/org/nanoboot/spriteutils/core/SpriteUtilsArgs.java +++ b/src/main/java/org/nanoboot/spriteutils/core/SpriteUtilsArgs.java @@ -1,19 +1,20 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // sprite-utils: Tool used to work with sprites -// Copyright (C) 2023-2023 the original author or authors. +// Copyright (C) 2024 the original author or authors. // -// This program is free software; you can redistribute it and/or +// This program is free software: you can redistribute it and/or // modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 -// of the License only. +// as published by the Free Software Foundation, either version 3 +// of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software +// along with this program. If not, see +// or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// package org.nanoboot.spriteutils.core; diff --git a/src/main/java/org/nanoboot/spriteutils/core/SpriteUtilsCommand.java b/src/main/java/org/nanoboot/spriteutils/core/SpriteUtilsCommand.java index b617301..bcdbcf3 100644 --- a/src/main/java/org/nanoboot/spriteutils/core/SpriteUtilsCommand.java +++ b/src/main/java/org/nanoboot/spriteutils/core/SpriteUtilsCommand.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // sprite-utils: Tool used to work with sprites -// Copyright (C) 2023-2023 the original author or authors. +// Copyright (C) 2024 the original author or authors. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/main/java/org/nanoboot/spriteutils/core/SpriteUtilsException.java b/src/main/java/org/nanoboot/spriteutils/core/SpriteUtilsException.java index 20a6c6a..afeb34b 100644 --- a/src/main/java/org/nanoboot/spriteutils/core/SpriteUtilsException.java +++ b/src/main/java/org/nanoboot/spriteutils/core/SpriteUtilsException.java @@ -1,19 +1,20 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // sprite-utils: Tool used to work with sprites -// Copyright (C) 2023-2023 the original author or authors. +// Copyright (C) 2024 the original author or authors. // -// This program is free software; you can redistribute it and/or +// This program is free software: you can redistribute it and/or // modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 -// of the License only. +// as published by the Free Software Foundation, either version 3 +// of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software +// along with this program. If not, see +// or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/org/nanoboot/spriteutils/core/Utils.java b/src/main/java/org/nanoboot/spriteutils/core/Utils.java index 4c1360b..fd52027 100644 --- a/src/main/java/org/nanoboot/spriteutils/core/Utils.java +++ b/src/main/java/org/nanoboot/spriteutils/core/Utils.java @@ -1,19 +1,20 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // sprite-utils: Tool used to work with sprites -// Copyright (C) 2023-2023 the original author or authors. +// Copyright (C) 2024 the original author or authors. // -// This program is free software; you can redistribute it and/or +// This program is free software: you can redistribute it and/or // modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 -// of the License only. +// as published by the Free Software Foundation, either version 3 +// of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software +// along with this program. If not, see +// or write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. /////////////////////////////////////////////////////////////////////////////////////////////// package org.nanoboot.spriteutils.core;