A few small things that i would like to suggest are:
1.
Instead of having the users override Destroy() of ObjectBase to handle finalizing, let users implement the IDisposable interface and use the standard
suggested finalizer.
This used to crash at a decent chance, when i just assigning a new AnimatedSprite to the old variable:
class AnimatedSprite : Sprite, IUpdateable, ICloneable, IDisposable
{
bool disposed = false;
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
void Dispose(bool disposing)
{
if (!this.disposed)
{
if (disposing)
{
// dispose managed ressources
EntityManager.Instance.UnregisterDrawable(this);
EntityManager.Instance.UnregisterUpdateable(this);
}
// dispose unmanaged ressources
}
}
~AnimatedSprite()
{
Dispose(false);
}
}
Access violations when i created a new instance of AnimatedSprite, although i handled disposing myself, until i found out i was supposed to overwrite Objectbase.Dispose() (using an almost empty override just to stop the garbage collector from finalizing the sprite, while sfml was still drawing the object).
2.
Remove the /////////////////////////////////////////////// first and last line of the xml doc tags.
Common IDEs such as Visual Studio and MonoDevelop will not display tooltips (i.e. IntelliSense), since they don't understand xml docu that way. (Also documentation compilers such as SandCastle will not be able to create a documentation that way)
3.
- Add explicit conversions for closely related types, such as Vector2f, Vector2i, Vector2u, e.g.
public static explicit operator Vector2f
(Vector2i vector
) { return new Vector2f
(vector
.X, vector
.Y); } - Add extension methods for closely related types, such as Vector2f, Vector2i, Vector2u, e.g.
public static class VectorExtensions
{ public static Vector2i ToVec2i
(this Vector2f vec
) { return new Vector2i
((int)vec
.X,
(int)vec
.Y); } public static Vector2u ToVec2u
(this Vector2f vec
) { return new Vector2u
((uint)vec
.X,
(uint)vec
.Y); } public static Vector2f ToVec2f
(this Vector2i vec
) { return new Vector2f
(vec
.X, vec
.Y); } public static Vector2u ToVec2u
(this Vector2i vec
) { return new Vector2u
((uint)vec
.X,
(uint)vec
.Y); } public static Vector2f ToVec2f
(this Vector2u vec
) { return new Vector2f
(vec
.X, vec
.Y); } public static Vector2f ToVec2i
(this Vector2u vec
) { return new Vector2f
(vec
.X, vec
.Y); } } allowing for a bit more comfort:
static void Main
(string[] args
){ Vector2f vec2f
= new Vector2f
(50f, 100f
); Vector2u displayResolution
= vec2f
.ToVec2u(); Vector2i vec2i
= new Vector2i
(50,
100); Vector2f someVec2f
= (Vector2f
)vec2i
;}