1865 Commits

Author SHA1 Message Date
Christopher Whitley 2906248f2f Use modifier frequency field (#1025) 2025-09-09 00:10:14 -04:00
Christopher Whitley d9cd99d4b9 Feature: Load Ember Particle Effects From File/Stream (#1023)
* Fix texture path resolution in ParticleEffectReader

This fixes texture loading issues when particle effect files reference textures with relative paths by properly resolving them against the effect file's location.

* Implement ParticleEffect FromFile/Stream methods
2025-09-08 00:36:37 -04:00
Christopher Whitley fd8eead241 Fix/textureatlas import error (#1017)
* Ensure that location of PNG is resolved relative to the JSON file directory in TexturePacker processor

* Bump version to 5.0.2

* Update tests
2025-08-24 03:20:29 -04:00
Christopher Whitley fee16bbd91 Bump version to 5.0.1 (#1015) 2025-08-16 16:23:16 -04:00
Christopher Whitley 50c9f04910 Auto Genereate Region Names in Textture2DAtlas.Create (#1014)
* Generate unique names for regions

Region names previously were generated using the name + bounds.  This was removed in #997 which caused a regression bug.

This is now fixed, and region names are generated using the common format of "name_index"

* Add tests for issue #1013
2025-08-16 16:20:27 -04:00
varelen a81171184a feat(ComponentMapper): Add 'TryGet' methods (#1006)
* feat(ComponentMapper): Add 'TryGet' methods

* feat(tests): Add test for new 'TryGet' method in 'ComponentMapper'

* refact(ComponentMapper): Simplify logic in 'TryGet' method
2025-08-16 15:04:04 -04:00
Christopher Whitley 5cb225ca56 Bump version to 5.0.0 (#1012) 2025-08-14 14:31:31 -04:00
Christopher Whitley a7672bd7fb Hotfix/monogame 384 compat (#1011)
* Hotfix: Update MonoGame reference to 3.8.4

* Bump patch version to 4.1.1

* update workflow to choose version tag

* Bump to version 4.1.2

* Resolve issues with KNI tests

* Bump version to 4.1.3
2025-08-13 11:42:27 -04:00
Christopher Whitley acc65421f3 Hotfix/monogame 384 compat (#1010)
* Hotfix: Update MonoGame reference to 3.8.4

* Bump patch version to 4.1.1

* update workflow to choose version tag

* Bump to version 4.1.2

* Resolve issues with KNI tests
2025-08-13 11:40:23 -04:00
Christopher Whitley dca32eeb39 Hotfix/monogame 384 compat (#1009)
* Hotfix: Update MonoGame reference to 3.8.4

* Bump patch version to 4.1.1

* update workflow to choose version tag

* Bump to version 4.1.2
2025-08-13 11:26:57 -04:00
Christopher Whitley f8d52cf325 Hotfix/monogame 384 compat (#1008)
* Hotfix: Update MonoGame reference to 3.8.4

* Bump patch version to 4.1.1
2025-08-13 11:00:00 -04:00
Andreas Loew 15d05c2c38 SpriteBatch.Draw() bugfixes (#1007)
* SpriteBatch.Draw with Texture2DRegion and rotation: improved implementation to get rid of Math.Sin/Cos; fixed clipping for sprites rotated on sprite sheet.

* SpriteBatch.Draw: fixed flipping for rotated sprites
2025-08-09 12:18:45 -04:00
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
varelen 59803aa1fe fix(RectangleF): Remove extra open curly braces in the 'ToString' method (#1005) 2025-08-03 17:30:24 -04:00
Diego García 33580aaaac Removed boxing in TweenMemberss getters and setters (#1002)
* Removed boxing in TweenMemberss getters and setters

* Removed unnecessary inclusions and comments

* Simplified the get method creation on @AristurtleDev 's suggestion
2025-07-30 14:24:43 -04:00
Christopher Whitley 393ba13013 Update contributing documentation (#1003)
* Update contributing documentation

* Add licensing section
2025-07-25 16:42:13 -04:00
Christopher Whitley 2ea7e85398 Updates to particle system for ember editor (#1001)
* Add enabled state for modifiers

* Add enabled state for interpolators

* Move AutoTrigger to effect not emitters

* Remove LineUniformProfile

* Set Enabled field true by default

* Don't render invisible emitters

* Remove unused member

* Document update method

* Add documentation

* Remove test now that LineUniformProfile was removed

* Fix unit tests
2025-07-25 00:52:05 -04:00
Christopher Whitley 96fe78c4a6 Initial Coding Guidelines (#987)
* Initial guidelines

* Add solution level directory with github related files for access within VS 2022

* Updated guidelines for extension methods

- For types within MonoGame.Extended, prefer static methods within the type rather than extension methods
- Extension methods should be used for extending external types from MonoGame or other libraries used.
2025-07-24 15:34:37 -04:00
Andreas Loew 4560ae70f8 fixed broken Rectangle.Clip() extensions method (#998)
(rectangle.Right depends on rectangle.X, which has been changed before; unit test will fail with old implementation)
2025-07-24 15:33:43 -04:00
Andreas Loew 27f7983aaf don't remove subdirectories from atlas image, this makes sprite management more flexible; (#999)
example: json data can be stored in sheetdata/player.json, texture can be stored in textures/player.png; player.json contains relative path to texture: image=../textures/player.png

don't remove subdirectories from atlas region names, to be able to load multiple animations from one texture atlas without conflicting region names;
example: walk/01.png, walk/02.png, ... turn/01.png, turn/02.png, ...
2025-07-24 15:29:04 -04:00
Christopher Whitley b33b1f5ec0 Just use texture name (#997) 2025-06-11 00:25:39 -04:00
Christopher Whitley ccd0c5ba2f Add Independent Axis Scale To Particles (#996)
* Make it so that the particles can scale independently on the x and y axis

* Close element

* Update tests with changes
2025-06-10 22:58:17 -04:00
Christopher Whitley 5fea9192f2 Use texture region bounds (#991) 2025-05-28 16:32:12 -04:00
Christopher Whitley 168d8fbc36 High-Performance Particle System Rewrite (#990)
* Refactor particle system

* Use correct alloc

* Use original ParticleIterator imlementation for zero allications.

* Move ParticleIterator to its own class instead of a nested class

* Mark nullable

* Add fallback mechanism for loading textures when it's an image file and not an xnb
2025-05-28 15:57:58 -04:00
Christopher Whitley 9fe1d3c619 Refactor HslColor and Color Utilities (#989)
* Refactor HslColor: Improve implementation, documentation, and API

- Added explicit memory layout to prepare for particle update.
- Restructured fields as private with readonly property accessors.  Struct is meant to be immutable, but the CopyTo method makes it mutable, so this is a trade off
- Added nullability annotations and explicit argument validations.
- Added Deconstruct method to match MonoGame terminology and marked Destruct as obsolete.
- Marked the implicit string conversion as obsolete.  Users should use the Parse method as it's more explicity as to what's happening.
- Restructure the FromRgb method for better readability and future maintenance.

* Deprecate ColorExtensions.ToHsl method in favor of HslColor.FromRgb

The ColorExtensions.ToHsl and HslColor.FromRgb methods provide the same functionality
but with different implementations. HslColor.FromRgb is more accurate and handles
edge cases correctly, so it should be preferred.

* Mark ColorExtensions.FromHex as obsolete

This just calls ColorHelper.FromHex, which is where the call site should be anyway as this isn't an extension method of Color.

* Move FromAbgr to ColorHelper.  This is not an extension method. Mark other as obsolete.

* Add a const value for machine epsilon

* Move ToRgb as a static method of HslColor struct

- ColorExtensions.ToRgb has been marked obsolete

* Mark ColorExtensions.ToRgb as obsolete

* Move ToHex from ColorHelper to ColorExtensions and make it an extension method. Marked ColorHelper.ToHex as obsolete

* Mark ColorHelper.FromHsl as obsolete

* Clean up namespaces

* Add FromHex overload that uses ReadOnlySpan<char> which increases performance and reduces memory allocations

* Update documentation of FromAbgr since it was moved to ColorHelper

* Fix <c> tag in documentation

* Per coding guidelines, fields at top of class declaration

* Per coding guidelines, prefix static fields with `s_`

* Document the FromName method

* Adhere to coding guidelines
- If statement, even single line, uses brackets
- Inline `Color` definition

* Documentat ColorHelper class

* Remove extra whitespace line

* Clean up unused namespaces

* Correct test case

* Move to root namespace

* Rename to HslColorTests

* Add tests for ColorExtensions.ToHex

* Use facts not theorys

* Add tests for ColorHelper.FromHex
2025-05-22 12:41:38 -04:00
Christopher Whitley b88e0d4ab1 Refactor FastRandom class with thread-safe shared instance (#986)
- Restructure FastRandom to use interface-based implementation approach
- Add thread-safe Shared static instance for concurrent access
- Enhance documentation with improved explanations about algorithm characteristics
- Extract core logic into LinearCongruentialGeneratorImpl for better maintainability
- Replace Math function calls with MathF equivalents for better performance
- Add parameter validation using new .NET ArgumentOutOfRangeException.ThrowIfNegativeOrZero
- Keep API compatibility with original implementation
2025-05-16 14:54:09 -04:00
Christopher Whitley f856694801 Update to use MonoGame 3.8.3 (#982) 2025-04-23 10:41:28 -04:00
amacocian 36d9b3084a Change CollisionEventArgs settter to init require (#978)
Closes #977
2025-03-20 10:41:30 -04:00
David Fidge c4bfb3c37f Fix for first animation frame always showing the first sprite sheet texture region rather than the first animation's texture region. (#972)
Co-authored-by: Christopher Whitley <103014489+AristurtleDev@users.noreply.github.com>
2025-03-01 22:01:36 -05:00
Wolfgang Schreurs b8d9203ef6 Set initial frame when animation is changed (#976)
Co-authored-by: Wolf <wolfgang.s@xardsyn.com>
2025-03-01 21:58:21 -05:00
Nikos Kastellanos e5f5bac062 upgrade KNI to v4.0 (#975) 2025-03-01 21:55:12 -05:00
Christopher Whitley b688d56e81 Remove prerelease part of workflow (#971) v4.0.4 2025-01-10 12:48:06 -05:00
Christopher Whitley 4a738ebd04 Version 4.0.4 release (#970) 2025-01-10 12:36:05 -05:00
Christopher Whitley e3406ab6e6 Ensure zero origin for sprite (#969)
Resolves issue #968
2025-01-10 12:26:40 -05:00
Jeremy Swartwood 080f5e1f23 Add compile time exclusion (#964)
* Add compile time exclusion

* Accept suggested changes
2024-11-20 00:02:30 -05:00
Eb3yr 8b02498317 Fix Invert(ref Matrix3x2) (#962)
* Fix Invert(ref Matrix3x2)

* erroneous results were given by matrix fields being altered sequentially, some fields would use new state instead of the input

* Check for matrix.Determinant() = 0, now returns the identity instead of det becoming infinite"

* Add unit test for Matrix3x2.Invert
2024-11-08 13:57:39 -05:00
Eb3yr d3b4482573 Unify and improve FromHex in ColorHelper.cs and ColorExtensions.cs (#961)
* Both now use ColorHelper.FromHex, rather than differing implementations

* FromHex now accepts hex numbers with three and four digits matching HTML color codes, where "ABC" maps to "AABBCC"

* Significant performance increase using bitshifts over string operations
2024-11-07 12:30:18 -05:00
Christopher Whitley a0613cff6c [Weekly] Version 4.0.3 (#952)
* Starting 4.0.2 release prep

* Update changelog

* Bump version number to 4.0.3

* Updated workflows to use dotnet 8
2024-09-29 23:02:00 -04:00
Jeremy Swartwood 9da44c8286 Revert UV code (#951) 2024-09-25 20:08:49 -04:00
Joseph Newman 18b60dc998 Fix bug when creating a NinePatch using the Texture2DRegion extension method (#948) 2024-09-23 01:35:17 -04:00
Dwergi 73562b691b BitmapFont now always loads from TitleContainer. (#946)
Fixes KNI web builds when using BitmapFont (#944)
2024-09-23 01:33:04 -04:00
Dwergi aed3d14c3b Fix bug when using NinePatch with Texture2DRegion. (#945)
Resolves #943
2024-09-23 01:29:06 -04:00
Ilia Bahrebar b3b4acb0da fix(Matrix3x2): decompose method (#941) 2024-09-23 01:22:28 -04:00
Christopher Whitley c814a65aea Bump version to 4.0.2 (#939) v4.0.2 2024-08-28 00:05:33 -04:00
Christopher Whitley b1ad92a7a0 Read particle file issue (#938)
* Correct exception message

* Pass serializer options as param for MultiDimensional reads

* Refactor to use TryGetRegion

* Update for System.Text.Json parsing
2024-08-27 23:58:42 -04:00
Christopher Whitley da81c353f6 Update for Monogame 3.8.2.1105 (#931)
* Update MonoGame references to 3.8.2.1105

* Vector2.Rotate is not built into MonoGame

* Update to net8

* Update version number

* Update changelog

* Deprecate Vector2.Rotate for MonoGame only

* Deprecate it but don't error it so API doesn't break for others.
v4.0.1
2024-08-17 22:27:28 -04:00
Srayan Jana 40d260b454 fix color extension bug (#925)
* fix color extension bug

* add preprocessor
2024-07-29 11:25:26 -04:00
Christopher Whitley 3ca0a3ef2a Resolves ArgmentNulLException When Loading BitmapFont From Disk. (#924)
* Correctly swap rayNear and rayFar distance

* Retrieve bmfFile.Path when reading from stream
This closes #923

* Return null if character not found.
This is used for line feed characters.S
2024-07-11 22:24:34 -04:00
Christopher Whitley f1fbf9c4b8 Correctly swap rayNear and rayFar distance (#922) 2024-07-11 21:48:40 -04:00
Christopher Whitley f56dc7b620 Use MaxSpeed when calculating speedGain (#921)
This calculation was never implemented from the Mercury Particle Engine port
2024-07-11 21:35:32 -04:00