Commit Graph

14 Commits

Author SHA1 Message Date
Christopher Whitley a501f76162 Sprite Rework (#897)
* Add file header

* Refator to file-scoped namespace

* Least complex to most complext method ordering

* Refactor: Group properties at top before constructor

* Use the new UV properties from Texture2DRegion.
This removes the dependency on the texture size in the calculations if the TextureRegion property is changed.

* No longer need to cache normalized origin to preserve it

* Use ArgumentNullException instead

* Use ArgumentNullException.ThrowIfNull

* Refactor:  Use brackets for readability

* Add xml documentation

* Add check for disposed texture

* Moved `Sprite` to `MonoGame.Extended.Graphics`

* Moved extension methods for rendering sprite into `SpriteBatch.Extensions`

* `ISpriteBatchDrawable` is not used by anything
It was originally part of the ScreneGraph implementation in MonoGame.Extended which was replaced by the ECS system.  It appears that this interface was forgotten to be removed and is not used for anything anymore.

* Add `CreateSprite` methods

* Add file header

* Moved `SpriteSheetAnimationFrame` to `MonoGame.Extended.Graphics`

* Move properties before constructor.

* Changed `Duration` to `TimeSpan` type

* Renamed `Index` to `FrameIndex`

* Add `TextureRegion` property

* Make property get only

* Cleanup whitespace

* Remove `SpriteSheetAnimationFrameJsonConverter`

* Cleanup unused namespaces

* Make file-scoped namespace

* Added xml documentation

* Added file header

* marked constructor as internal.
This will be created from a spritesheet itself

* Move `SpriteSheetAnimationCycle` to `MonoGame.Extended.Graphcis`

* File scoped namespace

* Add file header

* Reorganize: Move properties above constructor

* Make `Frames` property a read-only span

* Remove duration, this is being moved to the frame itself

* Add `Name` property

* Set looping, reversed, and ping pong properties in ctor

* Make ctor internal
This will be an object created by a spritesheet instane itself.

* Cleanup: Whitespace

* Add `FrameCount` property

* Add `GetFrame` method and accompanying `this[int]` method.

* Documentation: Added missing documentation.

* WIP: Temporary commit for workstation change

* WIP: Temporary commit for workstation change

* WIP: Temporary commit for workstation change

* WIP: Temporary commit for workstation change

* Refactor: Animation Refactor Completed

* Refactor: Sprite stuff finished

* Remove tests that can't be run on GitHub CI
Need to find alternative

* Make optional name param the last param in Texture2DRegion ctors

* Resolve merge conflicts
2024-06-23 23:10:16 -04:00
Nikos Kastellanos 4ecb74f6b6 Fna.Extended (#893)
* FNA projects

* update actions

fixes MSBUILD : error MSB1011: Specify which project or solution file to
use because this folder contains more than one project or solution file.

* build tests

* remove test for issue #633

* FNA/XNA compatible

* GraphicsDevice Extensions

* remove MockGameWindow

---------

Co-authored-by: Christopher Whitley <103014489+AristurtleDev@users.noreply.github.com>
2024-06-23 22:49:58 -04:00
Nikos Kastellanos 2bbdc38b51 Kni.Extended (#892)
* KNI projects

* update actions

fixes MSBUILD : error MSB1011: Specify which project or solution file to
use because this folder contains more than one project or solution file.

* remove test for issue #633

* build tests

* KNI TypeReaders

* KNI/XNA compatible code

* GetRuntimeReader from runtime types

* remove MockGameWindow
2024-06-23 22:38:20 -04:00
Christopher Whitley 8850875fb4 Texture Atlas Refactor (#890)
* Moved `TextureRegion2D` and `NinePatchRegion2D` into Graphics namespace
These are used for more than just texture atlas related things and are primarly for working with `Texture2D` instances and creating sub textures from them.  Moving them to Graphics namespace where `Texture2D` lives in MonoGame

* Dropped the `2D` suffix from `TextureRegion2D` and `NinePatchRegion2D`

* Moved `RectanglExtensions` to project root
This moves the extensions for `Rectangle` to the same relative namespace location as `Rectangle` is in MonoGame.

* Renamed to `Rectangle.Extensions.cs`

* Separate `Rectangle` from `RectangleF` extensions

* Added `GetRelativeRectangle` method

* Updated documentation

* Added `GetRelativeRectangle` method

* Updated documentation

* Top-level namespace

* Remove whitespace

* Move properties up

* Top-level namespace

* Don't recreate structs for `Bounds` and Size`
By having the property return a new struct, this allocates on the stack during situations like a loop during draw.

* Size should be `Size` not `SizeF` value
Textures deal in pixels (ints not floats)

* Removed setter for `Texture` property
Texture should not be set after region is created

* Added UV properties

* Refactor constructors

* Added documentation

* Added license header

* Make it an actual extension method

* Added `GetSubRegion` extension methods for `TextureRegion`

* Update documentation about ObjectDisposedException

* Move const values to top

* Resolve errors from`TextureRegion` refactor

* Update unit tests for TextureRegion refactor

* Started NinePatch rework

* Refactored NinePatch

* Update for texture region constructor change

* Remove ninepatch from atlas

* Moved `TextureAtlasExtensions` into `SpriteBatch.Extensions`
These are extension methods for the sprite batch

* Updated to use new `DrawTextureRegion` method after rename

* Renamed to NinePatchJsonConverter

* Removed `GetRegion<T>`
TextureAtlas no longer contains nine patch regions, so this method isn't needed

* Update after `NinePatchRegion2DJsonConverter` name change

* Resolve errors from NinePatch refactor

* TextureAtlas rework

* Renamed `TextureRegion` to `Texture2DRegion`

* Moved ContentReaders to new Content\ContentReaders directory

* Moved TextureAtlasJsonConvert to Serialization directory

* Adjusted name from `Texture*` to `Texture2D*`

* Update runtimereader and runtimettype strings
2024-06-15 01:37:18 -04:00
Christopher Whitley 66277568c8 Refactor BitmapFont (#887)
* Update file header

* Created initial project to move BitmapFont too

* XMl, Text, and Binar reading now supported for BMFont

* Refactor BittmapFont

* Update content pipeline from BitmapFont refactor

* Update changelog
2024-06-11 00:25:10 -04:00
Christopher Whitley 1119f82ff6 Add unit test for ContentReaderExtensions.GetRelativeAssetName (#877) 2024-05-29 11:40:59 -04:00
Christopher Whitley b9c011bee9 Added unit test to ensure issue is resolved (#876) 2024-05-29 11:11:50 -04:00
Christopher Whitley 9239fced04 Remove Point2 (#875)
* Added `CalculateMinimumVector2` and `CalculateMaximumVector2` as replacement for `Point2.Minimum` and `Point2.Maximum`

* Remove `Point2`
2024-05-29 01:32:50 -04:00
Christopher Whitley 25206c57da Rename Size2 to SizeF (#873) 2024-05-29 00:23:49 -04:00
Christopher Whitley 89c8984079 Add Edge Test for Polygon.Contains (#871)
* Added Assert for edge contains
Reference: https://github.com/craftworkgames/MonoGame.Extended/issues/214

* Renamed to PolygonTests
2024-05-27 17:58:54 -04:00
Christopher Whitley 49038f5d42 Replace Matrix2 with Matrix3x2 (#870)
* Replace `Matrix2` with `Matrix3x2`

* Update benchmarks

* Add XML documentation for `Matrix3x2`
2024-05-27 15:44:38 -04:00
Christopher Whitley d008b1bd41 Replace Newtonsoft.Json with System.Text.Json (#869)
* Converted to use `System.Text.Json`

* Remove Newtonsoft.Json Dependency
Newtonsoft.Json dependency has been removed in favor of System.Text.Json

* Treat MGFXO file as binary
2024-05-22 23:23:36 -04:00
Christopher Whitley a5209fecad Add common props for all tests 2024-05-18 20:40:12 -04:00
Christopher Whitley f68cff17bf Moved tests into test directory 2024-05-18 20:01:37 -04:00