From e53d956c21130e7e0035c3390d53922c20b55bf0 Mon Sep 17 00:00:00 2001 From: Maniekko <157877453+Maniekko@users.noreply.github.com> Date: Thu, 21 Mar 2024 16:12:14 +0300 Subject: [PATCH 1/3] Misc XML documentation --- MonoGame.Framework/Game.cs | 14 ++++++++++---- MonoGame.Framework/GameComponent.cs | 13 +++++++++++++ MonoGame.Framework/GameWindow.cs | 7 +++++++ .../Graphics/Effect/SkinnedEffect.cs | 5 ++++- MonoGame.Framework/Graphics/GraphicsDebug.cs | 3 +++ MonoGame.Framework/Graphics/OcclusionQuery.cs | 3 +++ .../Graphics/PresentationParameters.cs | 6 ++++++ MonoGame.Framework/Graphics/SpriteFont.cs | 18 +++++++++++++----- .../Platform/Graphics/OcclusionQuery.OpenGL.cs | 1 + .../Platform/Graphics/RenderTarget2D.OpenGL.cs | 1 + .../Graphics/RenderTargetCube.OpenGL.cs | 1 + .../Platform/Graphics/Texture.OpenGL.cs | 1 + .../Graphics/Vertices/IndexBuffer.OpenGL.cs | 1 + .../Graphics/Vertices/VertexBuffer.OpenGL.cs | 1 + MonoGame.Framework/Quaternion.cs | 7 +++++++ 15 files changed, 72 insertions(+), 10 deletions(-) diff --git a/MonoGame.Framework/Game.cs b/MonoGame.Framework/Game.cs index db44e271667..0d564da3c8e 100644 --- a/MonoGame.Framework/Game.cs +++ b/MonoGame.Framework/Game.cs @@ -86,7 +86,8 @@ public Game() PlatformConstruct(); } - + + /// ~Game() { Dispose(false); @@ -100,14 +101,16 @@ internal void Log(string Message) #region IDisposable Implementation - private bool _isDisposed; + private bool _isDisposed; + /// public void Dispose() { Dispose(true); GC.SuppressFinalize(this); EventHelpers.Raise(this, Disposed, EventArgs.Empty); } - + + /// protected virtual void Dispose(bool disposing) { if (!_isDisposed) @@ -192,7 +195,10 @@ public GameComponentCollection Components { get { return _components; } } - + + /// + /// Gets or sets time to sleep between frames when the game is not active + /// public TimeSpan InactiveSleepTime { get { return _inactiveSleepTime; } diff --git a/MonoGame.Framework/GameComponent.cs b/MonoGame.Framework/GameComponent.cs index 85f25c4f7fc..b3b2e91326e 100644 --- a/MonoGame.Framework/GameComponent.cs +++ b/MonoGame.Framework/GameComponent.cs @@ -20,6 +20,10 @@ public class GameComponent : IGameComponent, IUpdateable, IDisposable /// public Game Game { get; private set; } + /// + /// Indicates whether GameComponent.Update(GameTime) should be + /// called when Game.Update(GameTime) is called. + /// public bool Enabled { get { return _enabled; } @@ -33,6 +37,11 @@ public bool Enabled } } + /// + /// Indicates the order in which the + /// should be updated relative to other instances. + /// Lower values are updated first. + /// public int UpdateOrder { get { return _updateOrder; } @@ -61,11 +70,15 @@ public GameComponent(Game game) this.Game = game; } + /// ~GameComponent() { Dispose(false); } + /// + /// Called when the needs to be initialized. + /// public virtual void Initialize() { } /// diff --git a/MonoGame.Framework/GameWindow.cs b/MonoGame.Framework/GameWindow.cs index 72a3de2b342..6dc4bcb2ec9 100644 --- a/MonoGame.Framework/GameWindow.cs +++ b/MonoGame.Framework/GameWindow.cs @@ -218,6 +218,9 @@ protected void OnOrientationChanged () EventHelpers.Raise(this, OrientationChanged, EventArgs.Empty); } + /// + /// Called when the window needs to be painted. + /// protected void OnPaint () { } @@ -254,6 +257,10 @@ internal void OnFileDrop(FileDropEventArgs e) EventHelpers.Raise(this, FileDrop, e); } + /// + /// Sets the supported display orientations. + /// + /// Supported display orientations protected internal abstract void SetSupportedOrientations (DisplayOrientation orientations); /// diff --git a/MonoGame.Framework/Graphics/Effect/SkinnedEffect.cs b/MonoGame.Framework/Graphics/Effect/SkinnedEffect.cs index 80d1563b068..49c172fcbb8 100644 --- a/MonoGame.Framework/Graphics/Effect/SkinnedEffect.cs +++ b/MonoGame.Framework/Graphics/Effect/SkinnedEffect.cs @@ -19,7 +19,10 @@ namespace Microsoft.Xna.Framework.Graphics /// Built-in effect for rendering skinned character models. /// public class SkinnedEffect : Effect, IEffectMatrices, IEffectLights, IEffectFog, IEffectBones - { + { + /// + /// The maximum number of bones. + /// public const int MaxBones = 72; #region Effect Parameters diff --git a/MonoGame.Framework/Graphics/GraphicsDebug.cs b/MonoGame.Framework/Graphics/GraphicsDebug.cs index 50aa37fd656..63b42b38681 100644 --- a/MonoGame.Framework/Graphics/GraphicsDebug.cs +++ b/MonoGame.Framework/Graphics/GraphicsDebug.cs @@ -4,6 +4,9 @@ namespace Microsoft.Xna.Framework.Graphics { + /// + /// Represents a class for debugging graphics. + /// public partial class GraphicsDebug { /// diff --git a/MonoGame.Framework/Graphics/OcclusionQuery.cs b/MonoGame.Framework/Graphics/OcclusionQuery.cs index 3731b1be4b1..3d722ee8789 100644 --- a/MonoGame.Framework/Graphics/OcclusionQuery.cs +++ b/MonoGame.Framework/Graphics/OcclusionQuery.cs @@ -6,6 +6,9 @@ namespace Microsoft.Xna.Framework.Graphics { + /// + /// Used to perform an occlusion query against the latest drawn objects. + /// public partial class OcclusionQuery : GraphicsResource { private bool _inBeginEndPair; // true if Begin was called and End was not yet called. diff --git a/MonoGame.Framework/Graphics/PresentationParameters.cs b/MonoGame.Framework/Graphics/PresentationParameters.cs index e1fda0521d1..20893a44f73 100644 --- a/MonoGame.Framework/Graphics/PresentationParameters.cs +++ b/MonoGame.Framework/Graphics/PresentationParameters.cs @@ -15,10 +15,16 @@ namespace Microsoft.Xna.Framework.Graphics { + /// + /// Contains graphics presentation parameters. + /// public class PresentationParameters { #region Constants + /// + /// Default presentation rate + /// public const int DefaultPresentRate = 60; #endregion Constants diff --git a/MonoGame.Framework/Graphics/SpriteFont.cs b/MonoGame.Framework/Graphics/SpriteFont.cs index 3ece0924eb9..053280e16ea 100644 --- a/MonoGame.Framework/Graphics/SpriteFont.cs +++ b/MonoGame.Framework/Graphics/SpriteFont.cs @@ -11,7 +11,9 @@ namespace Microsoft.Xna.Framework.Graphics { - + /// + /// Represents a font texture. + /// public sealed class SpriteFont { internal static class Errors @@ -377,10 +379,16 @@ public struct Glyph /// /// Width of the character before kerning is applied. /// - public float WidthIncludingBearings; - - public static readonly Glyph Empty = new Glyph(); - + public float WidthIncludingBearings; + + /// + /// Returns an empty glyph. + /// + public static readonly Glyph Empty = new Glyph(); + + /// + /// Returns a string representation of this . + /// public override string ToString () { return "CharacterIndex=" + Character + ", Glyph=" + BoundsInTexture + ", Cropping=" + Cropping + ", Kerning=" + LeftSideBearing + "," + Width + "," + RightSideBearing; diff --git a/MonoGame.Framework/Platform/Graphics/OcclusionQuery.OpenGL.cs b/MonoGame.Framework/Platform/Graphics/OcclusionQuery.OpenGL.cs index 214311d1fe1..73f1e599409 100644 --- a/MonoGame.Framework/Platform/Graphics/OcclusionQuery.OpenGL.cs +++ b/MonoGame.Framework/Platform/Graphics/OcclusionQuery.OpenGL.cs @@ -46,6 +46,7 @@ private bool PlatformGetResult(out int pixelCount) return true; } + /// protected override void Dispose(bool disposing) { if (!IsDisposed) diff --git a/MonoGame.Framework/Platform/Graphics/RenderTarget2D.OpenGL.cs b/MonoGame.Framework/Platform/Graphics/RenderTarget2D.OpenGL.cs index 37a1f60ef2a..dfccc0ce08d 100644 --- a/MonoGame.Framework/Platform/Graphics/RenderTarget2D.OpenGL.cs +++ b/MonoGame.Framework/Platform/Graphics/RenderTarget2D.OpenGL.cs @@ -45,6 +45,7 @@ private void PlatformGraphicsDeviceResetting() { } + /// protected override void Dispose(bool disposing) { if (!IsDisposed) diff --git a/MonoGame.Framework/Platform/Graphics/RenderTargetCube.OpenGL.cs b/MonoGame.Framework/Platform/Graphics/RenderTargetCube.OpenGL.cs index 84b43e856f4..08b49d5c263 100644 --- a/MonoGame.Framework/Platform/Graphics/RenderTargetCube.OpenGL.cs +++ b/MonoGame.Framework/Platform/Graphics/RenderTargetCube.OpenGL.cs @@ -41,6 +41,7 @@ TextureTarget IRenderTarget.GetFramebufferTarget(RenderTargetBinding renderTarge }); } + /// protected override void Dispose(bool disposing) { if (!IsDisposed) diff --git a/MonoGame.Framework/Platform/Graphics/Texture.OpenGL.cs b/MonoGame.Framework/Platform/Graphics/Texture.OpenGL.cs index f018f2fc5af..503370a30dd 100644 --- a/MonoGame.Framework/Platform/Graphics/Texture.OpenGL.cs +++ b/MonoGame.Framework/Platform/Graphics/Texture.OpenGL.cs @@ -22,6 +22,7 @@ private void PlatformGraphicsDeviceResetting() glLastSamplerState = null; } + /// protected override void Dispose(bool disposing) { if (!IsDisposed) diff --git a/MonoGame.Framework/Platform/Graphics/Vertices/IndexBuffer.OpenGL.cs b/MonoGame.Framework/Platform/Graphics/Vertices/IndexBuffer.OpenGL.cs index bb53e3ee5a3..a35efbd9cb4 100644 --- a/MonoGame.Framework/Platform/Graphics/Vertices/IndexBuffer.OpenGL.cs +++ b/MonoGame.Framework/Platform/Graphics/Vertices/IndexBuffer.OpenGL.cs @@ -142,6 +142,7 @@ private void PlatformSetData(int offsetInBytes, T[] data, int startIndex, int } } + /// protected override void Dispose(bool disposing) { if (!IsDisposed) diff --git a/MonoGame.Framework/Platform/Graphics/Vertices/VertexBuffer.OpenGL.cs b/MonoGame.Framework/Platform/Graphics/Vertices/VertexBuffer.OpenGL.cs index 4400dfd82db..47d7d47868d 100644 --- a/MonoGame.Framework/Platform/Graphics/Vertices/VertexBuffer.OpenGL.cs +++ b/MonoGame.Framework/Platform/Graphics/Vertices/VertexBuffer.OpenGL.cs @@ -187,6 +187,7 @@ private void GetBufferData(int offsetInBytes, T[] data, int startIndex, int e } + /// protected override void Dispose(bool disposing) { if (!IsDisposed) diff --git a/MonoGame.Framework/Quaternion.cs b/MonoGame.Framework/Quaternion.cs index ab60c31b2cc..a848cedb831 100644 --- a/MonoGame.Framework/Quaternion.cs +++ b/MonoGame.Framework/Quaternion.cs @@ -1013,6 +1013,13 @@ public Vector4 ToVector4() return new Vector4(X,Y,Z,W); } + /// + /// Deconstruction method for . + /// + /// + /// + /// + /// public void Deconstruct(out float x, out float y, out float z, out float w) { x = X; From e081664e1f6c80b3f428221d54635d3d26801a74 Mon Sep 17 00:00:00 2001 From: Maniekko <157877453+Maniekko@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:32:51 +0300 Subject: [PATCH 2/3] [25.04.24]: Add XML documentation to IWindowInfo interface --- MonoGame.Framework/Platform/Graphics/IWindowInfo.OpenGL.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MonoGame.Framework/Platform/Graphics/IWindowInfo.OpenGL.cs b/MonoGame.Framework/Platform/Graphics/IWindowInfo.OpenGL.cs index 5bd57165eb3..7f1d778c26b 100644 --- a/MonoGame.Framework/Platform/Graphics/IWindowInfo.OpenGL.cs +++ b/MonoGame.Framework/Platform/Graphics/IWindowInfo.OpenGL.cs @@ -6,8 +6,14 @@ namespace MonoGame.OpenGL { + /// + /// Represents an interface for retrieving window information. + /// public interface IWindowInfo { + /// + /// Gets the handle of the window. + /// IntPtr Handle { get; } } } From 22bf195096a87e794034a877c94ab67d789241c7 Mon Sep 17 00:00:00 2001 From: "Simon (Darkside) Jackson" Date: Fri, 10 May 2024 12:34:58 +0100 Subject: [PATCH 3/3] Added missing text --- MonoGame.Framework/Quaternion.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MonoGame.Framework/Quaternion.cs b/MonoGame.Framework/Quaternion.cs index a848cedb831..3ad3bc591f4 100644 --- a/MonoGame.Framework/Quaternion.cs +++ b/MonoGame.Framework/Quaternion.cs @@ -1016,10 +1016,10 @@ public Vector4 ToVector4() /// /// Deconstruction method for . /// - /// - /// - /// - /// + /// The x coordinate in 3d-space. + /// The y coordinate in 3d-space. + /// The z coordinate in 3d-space. + /// The rotation component. public void Deconstruct(out float x, out float y, out float z, out float w) { x = X;