Skip to content

Commit d5e9f85

Browse files
committed
feat(editor): add scene2d rotation analytics hints (v2.0.11)
1 parent 1d819fc commit d5e9f85

4 files changed

Lines changed: 56 additions & 2 deletions

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.11] - 2026-04-05
6+
7+
### Added
8+
- **Scene2D Rotation Analytics:** `CustomGameEditor.java` now reports current rotation bounding-box size plus unique-vs-duplicate rotation counts for the selected piece, and the rotation overview buttons include bounding-box information.
9+
10+
### Changed
11+
- Bumped `VERSION.md` to `2.0.11`.
12+
13+
### Validation
14+
- `./gradlew compileJava` ✅
15+
516
## [2.0.10] - 2026-04-05
617

718
### Added

‎HANDOFF.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ This session focused on the newer Scene2D `CustomGameEditor` so the Java port ha
6969
- Added one-click Classic Drop, Cascade Puzzle, and Stack Arcade preset buttons on top of the Scene2D preset-slot workflow.
7070
- Bumped the Java repo version again to `2.0.10`.
7171

72+
### Additional Follow-Up - 2026-04-05 (Rotation Analytics)
73+
- Added current-rotation bounding-box size and unique-vs-duplicate rotation counts to the Scene2D custom editor summary.
74+
- Expanded rotation overview buttons to include bounding-box information.
75+
- Bumped the Java repo version again to `2.0.11`.
76+
7277
### Recommended Next Steps
7378
1. Add color/block-type controls to the Scene2D editor.
7479
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.10
1+
2.0.11

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

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ private void rebuildRotationOverview(PieceType pieceType) {
668668
final int rotationIndex = i;
669669
final Piece.Rotation rotation = pieceType.rotationSet.get(i);
670670
String prefix = (rotationIndex == selectedRotationIndex) ? "> " : "";
671-
TextButton button = new TextButton(prefix + "R" + rotationIndex + " (" + getFilledCellCount(rotation) + ")", engine.uiSkin);
671+
TextButton button = new TextButton(prefix + "R" + rotationIndex + " (" + getFilledCellCount(rotation) + ", " + getRotationBoundingBox(rotation) + ")", engine.uiSkin);
672672
button.addListener(new ClickListener() {
673673
@Override
674674
public void clicked(InputEvent event, float x, float y) {
@@ -687,6 +687,40 @@ private int getFilledCellCount(Piece.Rotation rotation) {
687687
return rotation == null ? 0 : rotation.blockOffsets.size();
688688
}
689689

690+
private String getRotationSignature(Piece.Rotation rotation) {
691+
if (rotation == null) return "empty";
692+
java.util.ArrayList<String> coords = new java.util.ArrayList<String>();
693+
for (Piece.BlockOffset offset : rotation.blockOffsets) {
694+
coords.add(offset.x + "," + offset.y);
695+
}
696+
java.util.Collections.sort(coords);
697+
return String.join("|", coords);
698+
}
699+
700+
private String getRotationBoundingBox(Piece.Rotation rotation) {
701+
if (rotation == null || rotation.blockOffsets.isEmpty()) return "0x0";
702+
int minX = Integer.MAX_VALUE;
703+
int maxX = Integer.MIN_VALUE;
704+
int minY = Integer.MAX_VALUE;
705+
int maxY = Integer.MIN_VALUE;
706+
for (Piece.BlockOffset offset : rotation.blockOffsets) {
707+
minX = Math.min(minX, offset.x);
708+
maxX = Math.max(maxX, offset.x);
709+
minY = Math.min(minY, offset.y);
710+
maxY = Math.max(maxY, offset.y);
711+
}
712+
return (maxX - minX + 1) + "x" + (maxY - minY + 1);
713+
}
714+
715+
private int getUniqueRotationCount(PieceType pieceType) {
716+
if (pieceType == null || pieceType.rotationSet == null) return 0;
717+
java.util.HashSet<String> signatures = new java.util.HashSet<String>();
718+
for (int i = 0; i < pieceType.rotationSet.size(); i++) {
719+
signatures.add(getRotationSignature(pieceType.rotationSet.get(i)));
720+
}
721+
return signatures.size();
722+
}
723+
690724
private void applyRuleCheckboxes() {
691725
currentGameType.moveDownAllLinesOverBlankSpacesAtOnce = cascadeGravityCheckbox.isChecked();
692726
currentGameType.gravityRule_onlyMoveDownDisconnectedBlocks = disconnectedGravityCheckbox.isChecked();
@@ -774,13 +808,17 @@ private void refreshEditorState() {
774808
}
775809

776810
int currentRotationCount = pieceType != null && pieceType.rotationSet != null ? pieceType.rotationSet.size() : 0;
811+
int uniqueRotationCount = getUniqueRotationCount(pieceType);
812+
int duplicateRotationCount = Math.max(0, currentRotationCount - uniqueRotationCount);
777813
summaryLabel.setText(
778814
"Mode: " + currentGameType.gameMode
779815
+ " | Grid: " + currentGameType.gridWidth + "x" + currentGameType.gridHeight
780816
+ " | Pieces: " + currentGameType.pieceTypes.size()
781817
+ " | Rotations: " + getTotalRotationCount()
782818
+ " | Current piece rotations: " + currentRotationCount
783819
+ " | Filled cells in current rotation: " + getFilledCellCount(rotation)
820+
+ " | Current bbox: " + getRotationBoundingBox(rotation)
821+
+ " | Unique/duplicate rotations: " + uniqueRotationCount + "/" + duplicateRotationCount
784822
+ " | Rules: " + getEnabledRuleSummary()
785823
);
786824
}

0 commit comments

Comments
 (0)