Andreas Loew de157c44e8 Texture2DRegion: support trimmed and rotated sprites optionally load origin from atlas data file (#1004)
* Added the following features to Texture2DRegion to improve sprite sheet packing efficiency:
- Regions on the texture can now be rotated.
- Transparent borders around sprites can be trimmed.

The SpriteBatch.Draw method will automatically rotate the region back to its original orientation and restore the transparent borders during rendering.

Additionally, since sprite sheet data files can define sprite origins, TextureRegion2D can now optionally store this origin. Sprites created from a Texture2DRegion will use this stored origin as their default.

* Adapted nine-patch sprite implementation for support rotated / trimmed sprites, too.

* Extended the TextureAtlas content pipeline to support trimmed and rotated sprites, as well as reading anchor points (origins) from the data file.
The JSON format has been cleaned up by removing unnecessary keys. The legacy format remains supported for backward compatibility.

* added build-time check to ensure that texture image file referenced by atlas data file exists
2025-08-04 12:04:25 -04:00
2024-05-20 02:12:43 -04:00
2024-06-23 23:10:16 -04:00
2024-05-20 02:12:43 -04:00
2024-08-28 00:05:33 -04:00

MonoGame.Extended Logo

MonoGame.Extended

MonoGame.Extended is a set of utilities (in the form of libraries/tools) to MonoGame that makes it easier to make games. Choose what you want, the rest stays out of your way. It makes MonoGame more awesome.

Docs

Getting started

Code is distributed as NuGet packages in the form of libraries (.dll files). You can easily install the NuGet packages into your existing MonoGame project using the NuGet Package Manager UI in Visual Studio or by using the command line interface (CLI) in a terminal.

dotnet add package MonoGame.Extended --version 4.0.2

Using the Content Pipeline Extensions

To use the content pipeline extension, please refer to the Setup MGCB Edtior documentation.

Where to next?

Patreon Supporters

The patreon has been removed. If you would like to support the maintainers of this project, please consider using the GitHub sponsors link for one of the maintainers.

As a special thanks to those that supported this project through Patreon in the past, their websites were linked in this readme and have been preserved below:

Special Thanks

And a special thinks to all contributors!

License

MonoGame.Extended is released under the MIT License (MIT). Please refer to the LICENSE file for full license text.

S
Description
Extensions to make MonoGame more awesome
Readme MIT 16 MiB
Languages
C# 99.7%
HLSL 0.3%