Skip to content

Commit

Permalink
feat: Adding atlas packing spacing option to TiledOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzanardo committed Nov 23, 2023
1 parent ed4b039 commit f7f1886
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 2 additions & 0 deletions packages/leap/lib/src/leap_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ class LeapMap extends PositionComponent with HasGameRef<LeapGame> {
tsxPackingFilter: tiledOptions.tsxPackingFilter,
useAtlas: tiledOptions.useAtlas,
layerPaintFactory: tiledOptions.layerPaintFactory,
atlasPackingSpacingX: tiledOptions.atlasPackingSpacingX,
atlasPackingSpacingY: tiledOptions.atlasPackingSpacingY,
);
return LeapMap(
tileSize: tileSize,
Expand Down
10 changes: 10 additions & 0 deletions packages/leap/lib/src/leap_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class TiledOptions {
this.tsxPackingFilter,
this.useAtlas = true,
this.layerPaintFactory,
this.atlasPackingSpacingX = 0,
this.atlasPackingSpacingY = 0,
});

/// Which layer name should be used for the player, defaults to "Ground".
Expand Down Expand Up @@ -93,4 +95,12 @@ class TiledOptions {
/// When ommited, resorts to Flame Tiled one, which creates a
/// a white Paint with the layer opacity value.
final Paint Function(double opacity)? layerPaintFactory;

/// The horizontal spacing between tilesets in the atlas texture,
/// defaults to 0.
final double atlasPackingSpacingX;

/// The vertical between tilesets in the atlas texture,
/// defaults to 0.
final double atlasPackingSpacingY;
}
14 changes: 6 additions & 8 deletions packages/leap/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ packages:
flame:
dependency: "direct main"
description:
name: flame
sha256: b6bb76224fc29fd5eea25d66cda6e322e3678bdedc1f65956c6151326a6a798b
url: "https://pub.dev"
source: hosted
path: "../../../flame/packages/flame"
relative: true
source: path
version: "1.10.1"
flame_behaviors:
dependency: "direct main"
Expand All @@ -100,10 +99,9 @@ packages:
flame_tiled:
dependency: "direct main"
description:
name: flame_tiled
sha256: "38d03b94b27299d321d325c6aea54023bd793ae167c6c7f92fb7de81a5acfd4f"
url: "https://pub.dev"
source: hosted
path: "../../../flame/packages/flame_tiled"
relative: true
source: path
version: "1.17.0"
flutter:
dependency: "direct main"
Expand Down
4 changes: 4 additions & 0 deletions packages/leap/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ dependencies:
pathxp: ^0.4.0
tiled: ^0.10.1

dependency_overrides:
flame_tiled:
path: ../../../flame/packages/flame_tiled

dev_dependencies:
flame_lint: ^1.1.1
flutter_test:
Expand Down

0 comments on commit f7f1886

Please sign in to comment.