Skip to content

Commit 2f88931

Browse files
committed
feat(editor): add scene2d normalize-all helper (v2.0.15)
1 parent 8505add commit 2f88931

4 files changed

Lines changed: 46 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [2.0.15] - 2026-04-05
6+
7+
### Added
8+
- **Scene2D Normalize-All Helper:** `CustomGameEditor.java` now provides a one-click helper to normalize every rotation in the selected piece, making full-set cleanup much faster.
9+
10+
### Changed
11+
- Bumped `VERSION.md` to `2.0.15`.
12+
13+
### Validation
14+
- `./gradlew compileJava`
15+
516
## [2.0.14] - 2026-04-05
617

718
### Added

HANDOFF.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ This session focused on the newer Scene2D `CustomGameEditor` so the Java port ha
8686
- Added a one-click duplicate-rotation cleanup action to the Scene2D custom editor.
8787
- Bumped the Java repo version again to `2.0.14`.
8888

89+
### Additional Follow-Up - 2026-04-05 (Normalize-All Helper)
90+
- Added a one-click helper to normalize every rotation in the selected piece.
91+
- Bumped the Java repo version again to `2.0.15`.
92+
8993
### Recommended Next Steps
9094
1. Add color/block-type controls to the Scene2D editor.
9195
2. Bridge Scene2D custom editor state into the older TWL editor stack where useful.

VERSION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.14
1+
2.0.15

src/main/java/com/bobsgame/client/engine/game/gui/customGameEditor/CustomGameEditor.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class CustomGameEditor extends Scene2DPanel {
3737
private final TextButton duplicateRotationBtn;
3838
private final TextButton normalizeRotationBtn;
3939
private final TextButton centerRotationBtn;
40+
private final TextButton normalizeAllRotationsBtn;
4041
private final TextButton removeDuplicateRotationsBtn;
4142
private final TextButton removeRotationBtn;
4243
private final TextButton prevPieceBtn;
@@ -123,6 +124,7 @@ public CustomGameEditor(Engine engine) {
123124
duplicateRotationBtn = new TextButton("Duplicate Rotation", skin);
124125
normalizeRotationBtn = new TextButton("Normalize Rotation", skin);
125126
centerRotationBtn = new TextButton("Center Rotation", skin);
127+
normalizeAllRotationsBtn = new TextButton("Normalize All", skin);
126128
removeDuplicateRotationsBtn = new TextButton("Clear Duplicates", skin);
127129
removeRotationBtn = new TextButton("Remove Rotation", skin);
128130
prevPieceBtn = new TextButton("< Piece", skin);
@@ -155,6 +157,7 @@ public CustomGameEditor(Engine engine) {
155157
controlsRow1.add(duplicateRotationBtn);
156158
controlsRow1.add(normalizeRotationBtn);
157159
controlsRow1.add(centerRotationBtn);
160+
controlsRow1.add(normalizeAllRotationsBtn);
158161
controlsRow1.add(removeDuplicateRotationsBtn);
159162
controlsRow1.add(removeRotationBtn);
160163
controlsRow1.add(clearRotationBtn);
@@ -307,6 +310,13 @@ public void clicked(InputEvent event, float x, float y) {
307310
}
308311
});
309312

313+
normalizeAllRotationsBtn.addListener(new ClickListener() {
314+
@Override
315+
public void clicked(InputEvent event, float x, float y) {
316+
normalizeAllRotations();
317+
}
318+
});
319+
310320
removeDuplicateRotationsBtn.addListener(new ClickListener() {
311321
@Override
312322
public void clicked(InputEvent event, float x, float y) {
@@ -645,6 +655,26 @@ private void centerCurrentRotation() {
645655
refreshEditorState();
646656
}
647657

658+
private void normalizeAllRotations() {
659+
PieceType pieceType = getSelectedPiece();
660+
if (pieceType == null || pieceType.rotationSet == null || pieceType.rotationSet.size() == 0) return;
661+
for (int i = 0; i < pieceType.rotationSet.size(); i++) {
662+
Piece.Rotation rotation = pieceType.rotationSet.get(i);
663+
if (rotation == null || rotation.blockOffsets.isEmpty()) continue;
664+
int minX = Integer.MAX_VALUE;
665+
int minY = Integer.MAX_VALUE;
666+
for (Piece.BlockOffset offset : rotation.blockOffsets) {
667+
minX = Math.min(minX, offset.x);
668+
minY = Math.min(minY, offset.y);
669+
}
670+
for (Piece.BlockOffset offset : rotation.blockOffsets) {
671+
offset.x -= minX;
672+
offset.y -= minY;
673+
}
674+
}
675+
refreshEditorState();
676+
}
677+
648678
private void removeDuplicateRotations() {
649679
final PieceType pieceType = getSelectedPiece();
650680
if (pieceType == null || pieceType.rotationSet == null || pieceType.rotationSet.size() == 0) return;

0 commit comments

Comments
 (0)