Here are all of my extensions I’ve made for general use creating my UI editor project. Notably, to go along with MonoGame’s SpriteFont.MeasureString(), I’ve added
This returns a list of RectangleF of the area of the text, taking into account each \n line of text being a separate area, whereas MeasureString() is much less accurate, returning one big area encompassing all text. There’s also
These extensions were necessary for my text editing code. Whomever developer might be listening, feel free to add these extensions to ME. Currently working on a SpriteFont extension to return the index of a character given a point in space.
There are also a couple of conversion methods I think would be very useful. This method was particularly useful when drawing to Windows forms, and pretty tricky to get right.
System.Drawing.Image ToImage(this Texture2D texture)
And lastly, there are many point conversion extensions. All generic 2 vector types should probably be interchangeable, though I didn’t add them all
ToPoint() ToPoint2() ToSize2() ToVector2() ToSystemDrawingPoint()
And then maybe
Tuple<int, int> Tuple<float, float>
Although there might be a more elegant way to do this.