forked from libgdx/libgdx
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for Layer TintColor in TiledMap (libgdx#7076)
* Added in Ability to load in the tintcolor attribute from a tiled tmx file. This will replicate the layer tinting found in tiled. Added Opacity on a Group Parent Layer to affect child layers as this was not implemented previously, it now replicates what tiled does, same goes for the new tint color working on group layers. There was a typo in one of the comments in the Color class. I cleaned it up and removed the typo. * Added Test TiledMapLayerTintOpacityTest for the new tintcolor layer. And modified a missed piece of code in OrthoCachedTiledMapRenderer * Apply formatter * Changed background color of map test to reflect default tiled background color. * Added tinting code to all the renderImageLayer() to specifically work as seen in the TiledMap Editor. Slight refactoring of tinting related code in MapLayer. Updated rendering code to use the combined Tint Color of the layer and it's parent to match what is seen in the TiledMap Editor. Modified all previous tinting test maps to include image layers. Added one new test map which includes a bunch of nested parent groups. * Apply formatter * Added method to check if image contained in TiledMapImageLayer supports transparency or not based on if it contains a png or gif (since they are supported by TiledMap Editor. Modified render logic based on transparency support of image format. Added small png badlogic logo to testmaps. * Apply formatter * Created 2 methods in BatchTiledMapRenderer specifically related to calculating the render colors for ImageLayers and TileLayers. This code was duplicated throughout 5 Map renderers. This should help clean it up and give a single point of entry for calculating colors for the map renderer's that extend the BatchTiledMapRenderer. Refactored methods meant to check for transparency support in the TiledMapImageLayer. Now we directly check against the image texture's pixel format to determine whether this image can properly handle alpha values in a tint color. Created static helper method in BaseTmxMapLoader meant to be used to translate TiledMap color formats to the libGDX equivalent. This cuts down on code duplication and is available for use elsewhere if needed. Removed redundant 1 values from OrthoCachedTiledMapRenderer Color multiplication. Small changes to 3 of the test maps, (image positions, etc) * Apply formatter * Moved tiled color utility method to BaseTiledMapLoader. Updated BaseTmjMapLoader to parse tint colors to be in parity with the BaseTmxMapLoader. * Apply formatter --------- Co-authored-by: GitHub Action <[email protected]>
- Loading branch information
1 parent
569d2c7
commit 0dc2774
Showing
23 changed files
with
1,231 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+14.3 KB
...-android/assets/data/maps/tiled-tint-opacity/badlogic-with-whitespace-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.