Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support TMX relative path for Source texture #1303

Merged
merged 2 commits into from Jan 7, 2024

Conversation

DeathPhoenix22
Copy link
Contributor

@DeathPhoenix22 DeathPhoenix22 commented Oct 11, 2023

Hi,

Issue Link: #1302

This change ensures that we can use the path specified on the tmx map file instead of removing the source file path at resource load time.

@AlmasB
Copy link
Owner

AlmasB commented Nov 1, 2023

Hi, could you add a test for this. Can we copy an existing texture into another test directory, so that the tmx references a relative path, that should make it fail (i.e. return a dummy texture)?

@codecov-commenter
Copy link

codecov-commenter commented Nov 1, 2023

Codecov Report

Merging #1303 (4a6d32c) into dev (76cdf21) will decrease coverage by 0.04%.
Report is 6 commits behind head on dev.
The diff coverage is 100.00%.

❗ Current head 4a6d32c differs from pull request most recent head f8853b4. Consider uploading reports for the commit f8853b4 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@             Coverage Diff              @@
##                dev    #1303      +/-   ##
============================================
- Coverage     59.60%   59.57%   -0.04%     
+ Complexity     2962     2956       -6     
============================================
  Files           308      308              
  Lines         15199    15199              
  Branches       1558     1558              
============================================
- Hits           9060     9055       -5     
- Misses         5610     5620      +10     
+ Partials        529      524       -5     
Files Coverage Δ
...om/almasb/fxgl/entity/level/tiled/TilesetLoader.kt 77.72% <100.00%> (ø)

... and 4 files with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@DeathPhoenix22
Copy link
Contributor Author

Hi,
I've added tests. It took me several hours to figure out a way to find a difference between a Dummy image and an Image. I finally decided to add-up all pixels. This is due to the fact that the dummy Image is a valid image with all correct properties :)

I've added an extra test that validates the checksum strategy.

Hopefully, this suites the testing needs.

Copy link
Owner

@AlmasB AlmasB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, many thanks.

var sum = 0
for (x in 0 until image.getWidth().toInt()) {
for (y in 0 until image.getHeight().toInt()) {
sum += image.getPixelReader().getArgb(x, y)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how big argb values are, so perhaps Long is more suitable. Though I suppose identical values will overflow in the same way, so Int should work too.

@AlmasB AlmasB merged commit a8f184e into AlmasB:dev Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants