Skip to content

Commit

Permalink
Improvements to docs and fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Jjagg committed Jul 27, 2020
1 parent 4249192 commit 24ae11f
Show file tree
Hide file tree
Showing 9 changed files with 270 additions and 256 deletions.
2 changes: 1 addition & 1 deletion MonoGame.Framework/DrawableGameComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public bool Visible
/// <summary>
/// Create a <see cref="DrawableGameComponent"/>.
/// </summary>
/// <param name="game">The game that this <see cref="DrawableGameComponent"/> this component belongs to.</param>
/// <param name="game">The game that this component will belong to.</param>
public DrawableGameComponent(Game game)
: base(game)
{
Expand Down
16 changes: 11 additions & 5 deletions MonoGame.Framework/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
namespace Microsoft.Xna.Framework
{
/// <summary>
/// A class that is the entry point for most games. Handles setting up
/// a window and graphics and runs a game loop that calls.
/// This class is the entry point for most games. Handles setting up
/// a window and graphics and runs a game loop that calls <see cref="Update"/> and <see cref="Draw"/>.
/// </summary>
public partial class Game : IDisposable
{
Expand Down Expand Up @@ -268,6 +268,7 @@ public TimeSpan TargetElapsedTime

/// <summary>
/// Indicates if this game is running with a fixed time between frames.
///
/// When set to <code>true</code> the target time between frames is
/// given by <see cref="TargetElapsedTime"/>.
/// </summary>
Expand Down Expand Up @@ -497,7 +498,9 @@ public void Run(GameRunBehavior runBehavior)
#endif

/// <summary>
/// One iteration of the game loop. Makes at least one call to <see cref="Update"/>
/// Run one iteration of the game loop.
///
/// Makes at least one call to <see cref="Update"/>
/// and exactly one call to <see cref="Draw"/> if drawing is not supressed.
/// When <see cref="IsFixedTimeStep"/> is set to <code>false</code> this will
/// make exactly one call to <see cref="Update"/>.
Expand Down Expand Up @@ -655,8 +658,9 @@ protected virtual void LoadContent() { }
protected virtual void UnloadContent() { }

/// <summary>
/// Initializes attached <see cref="GameComponent"/> instances and calls <see cref="LoadContent"/>.
/// Override this to initialize the game and load any needed non-graphical resources.
///
/// Initializes attached <see cref="GameComponent"/> instances and calls <see cref="LoadContent"/>.
/// </summary>
protected virtual void Initialize()
{
Expand Down Expand Up @@ -687,10 +691,11 @@ protected virtual void Initialize()

/// <summary>
/// Called when the game should draw a frame.
///
/// Draws the <see cref="DrawableGameComponent"/> instances attached to this game.
/// Override this to render your game.
/// </summary>
/// <param name="gameTime">The elapsed time since the last call to <see cref="Draw"/>.</param>
/// <param name="gameTime">A <see cref="GameTime"/> instance containing the elapsed time since the last call to <see cref="Draw"/> and the total time elapsed since the game started.</param>
protected virtual void Draw(GameTime gameTime)
{

Expand All @@ -702,6 +707,7 @@ protected virtual void Draw(GameTime gameTime)

/// <summary>
/// Called when the game should update.
///
/// Updates the <see cref="GameComponent"/> instances attached to this game.
/// Override this to update your game.
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions MonoGame.Framework/GameComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
namespace Microsoft.Xna.Framework
{
/// <summary>
/// An object that can be attached to a <see cref="Game"/> and have its <see cref="Update"/>
/// method called by that <see cref="Game"/>.
/// An object that can be attached to a <see cref="Microsoft.Xna.Framework.Game"/> and have its <see cref="Update"/>
/// method called when <see cref="Microsoft.Xna.Framework.Game.Update"/> is called.
/// </summary>
public class GameComponent : IGameComponent, IUpdateable, IDisposable
{
Expand Down Expand Up @@ -55,7 +55,7 @@ public int UpdateOrder
/// <summary>
/// Create a <see cref="GameComponent"/>.
/// </summary>
/// <param name="game">The game that this <see cref="GameComponent"/> this component belongs to.</param>
/// <param name="game">The game that this component will belong to.</param>
public GameComponent(Game game)
{
this.Game = game;
Expand Down
62 changes: 33 additions & 29 deletions MonoGame.Framework/GameTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,61 @@

namespace Microsoft.Xna.Framework
{
/// <summary>
/// Holds the time state of a <see cref="Game"/>.
/// </summary>
/// <summary>
/// Holds the time state of a <see cref="Game"/>.
/// </summary>
public class GameTime
{
/// <summary>
/// Time since the start of the <see cref="Game"/>.
/// </summary>
/// <summary>
/// Time since the start of the <see cref="Game"/>.
/// </summary>
public TimeSpan TotalGameTime { get; set; }

/// <summary>
/// Time since the last call to <see cref="Game.Update"/>.
/// </summary>
/// <summary>
/// Time since the last call to <see cref="Game.Update"/>.
/// </summary>
public TimeSpan ElapsedGameTime { get; set; }

/// <summary>
/// Indicates whether the <see cref="Game"/> is running slowly.
/// </summary>
/// <summary>
/// Indicates whether the <see cref="Game"/> is running slowly.
///
/// This flag is set to <c>true</c> when <see cref="Game.IsFixedTimeStep"/> is set to <c>true</c>
/// and a tick of the game loop takes longer than <see cref="Game.TargetElapsedTime"/> for
/// a few frames in a row.
/// </summary>
public bool IsRunningSlowly { get; set; }

/// <summary>
/// Create a <see cref="GameTime"/> instance with a <see cref="TotalGameTime"/> and
/// <see cref="ElapsedGameTime"/> of <code>0</code>.
/// </summary>
/// <summary>
/// Create a <see cref="GameTime"/> instance with a <see cref="TotalGameTime"/> and
/// <see cref="ElapsedGameTime"/> of <code>0</code>.
/// </summary>
public GameTime()
{
TotalGameTime = TimeSpan.Zero;
ElapsedGameTime = TimeSpan.Zero;
IsRunningSlowly = false;
}

/// <summary>
/// Create a <see cref="GameTime"/> with the specified <see cref="TotalGameTime"/>
/// and <see cref="ElapsedGameTime"/>.
/// </summary>
/// <param name="totalGameTime">The total game time elapsed since the start of the <see cref="Game"/>.</param>
/// <param name="elapsedGameTime">The time elapsed since the last call to <see cref="Game.Update"/>.</param>
/// <summary>
/// Create a <see cref="GameTime"/> with the specified <see cref="TotalGameTime"/>
/// and <see cref="ElapsedGameTime"/>.
/// </summary>
/// <param name="totalGameTime">The total game time elapsed since the start of the <see cref="Game"/>.</param>
/// <param name="elapsedGameTime">The time elapsed since the last call to <see cref="Game.Update"/>.</param>
public GameTime(TimeSpan totalGameTime, TimeSpan elapsedGameTime)
{
TotalGameTime = totalGameTime;
ElapsedGameTime = elapsedGameTime;
IsRunningSlowly = false;
}

/// <summary>
/// Create a <see cref="GameTime"/> with the specified <see cref="TotalGameTime"/>
/// and <see cref="ElapsedGameTime"/>.
/// </summary>
/// <param name="totalRealTime">The total game time elapsed since the start of the <see cref="Game"/>.</param>
/// <param name="elapsedRealTime">The time elapsed since the last call to <see cref="Game.Update"/>.</param>
/// <param name="isRunningSlowly">A value indicating if the <see cref="Game"/> is running slowly.</param>
/// <summary>
/// Create a <see cref="GameTime"/> with the specified <see cref="TotalGameTime"/>
/// and <see cref="ElapsedGameTime"/>.
/// </summary>
/// <param name="totalRealTime">The total game time elapsed since the start of the <see cref="Game"/>.</param>
/// <param name="elapsedRealTime">The time elapsed since the last call to <see cref="Game.Update"/>.</param>
/// <param name="isRunningSlowly">A value indicating if the <see cref="Game"/> is running slowly.</param>
public GameTime (TimeSpan totalRealTime, TimeSpan elapsedRealTime, bool isRunningSlowly)
{
TotalGameTime = totalRealTime;
Expand Down
23 changes: 12 additions & 11 deletions MonoGame.Framework/GameWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ public abstract class GameWindow
public abstract DisplayOrientation CurrentOrientation { get; }

/// <summary>
/// The handle to the window used by the backend windowing service. Note that this is not
/// always the native window handle, for example in a DesktopGL application this is the SDL
/// window handle.
/// The handle to the window used by the backend windowing service.
///
/// For WindowsDX this is the Win32 window handle (HWND).
/// For DesktopGL this is the SDL window handle.
/// For UWP this is a handle to an IUnknown interface for the CoreWindow.
/// </summary>
public abstract IntPtr Handle { get; }

Expand All @@ -64,7 +66,7 @@ public abstract class GameWindow
/// Gets or sets the title of the game window.
/// </summary>
/// <remarks>
/// For Windows 8 and Windows 10 UWP this has no effect. For these platforms the title should be
/// For UWP this has no effect. The title should be
/// set by using the DisplayName property found in the app manifest file.
/// </remarks>
public string Title {
Expand All @@ -78,10 +80,10 @@ public string Title {
}

/// <summary>
/// Determines whether the border of the window is visible. Currently only supported on the WinDX and WinGL/Linux platforms.
/// Determines whether the border of the window is visible. Currently only supported on the WindowsDX and DesktopGL platforms.
/// </summary>
/// <exception cref="System.NotImplementedException">
/// Thrown when trying to use this property on a platform other than the WinDX and WinGL/Linux platforms.
/// Thrown when trying to use this property on a platform other than WinowsDX or DesktopGL.
/// </exception>
public virtual bool IsBorderless
{
Expand Down Expand Up @@ -129,14 +131,13 @@ protected GameWindow()
#if WINDOWS || WINDOWS_UAP || DESKTOPGL|| ANGLE

/// <summary>
/// Use this event to retrieve text for objects like textbox's.
/// This event is not raised by noncharacter keys.
/// Use this event to user text input.
///
/// This event is not raised by noncharacter keys except control characters such as backspace, tab, carriage return and escape.
/// This event also supports key repeat.
/// For more information this event is based off:
/// http://msdn.microsoft.com/en-AU/library/system.windows.forms.control.keypress.aspx
/// </summary>
/// <remarks>
/// This event is only supported on the Windows DirectX, Windows OpenGL and Linux platforms.
/// This event is only supported on desktop platforms.
/// </remarks>
public event EventHandler<TextInputEventArgs> TextInput;

Expand Down
1 change: 1 addition & 0 deletions MonoGame.Framework/Graphics/IGraphicsDeviceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public interface IGraphicsDeviceService
/// <summary>
/// Raised when the <see cref="GraphicsDevice"/> has reset.
/// </summary>
/// <seealso cref="Microsoft.Xna.Framework.Graphics.GraphicsDevice.Reset"/>
event EventHandler<EventArgs> DeviceReset;

/// <summary>
Expand Down
38 changes: 20 additions & 18 deletions MonoGame.Framework/GraphicsDeviceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void EndDraw()
}
}

#region IGraphicsDeviceService Members
#region Events

/// <inheritdoc />
public event EventHandler<EventArgs> DeviceCreated;
Expand All @@ -175,10 +175,19 @@ public void EndDraw()
public event EventHandler<EventArgs> DeviceDisposing;

/// <inheritdoc />
public event EventHandler<EventArgs> DeviceReset;
public event EventHandler<EventArgs> DeviceResetting;

/// <inheritdoc />
public event EventHandler<EventArgs> DeviceResetting;
public event EventHandler<EventArgs> DeviceReset;

/// <summary>
/// Called when a <see cref="GraphicsDevice"/> is created. Raises the <see cref="DeviceCreated"/> event.
/// </summary>
/// <param name="e"></param>
protected void OnDeviceCreated(EventArgs e)
{
EventHelpers.Raise(this, DeviceCreated, e);
}

/// <summary>
/// Called when a <see cref="GraphicsDevice"/> is disposed. Raises the <see cref="DeviceDisposing"/> event.
Expand All @@ -199,25 +208,16 @@ protected void OnDeviceResetting(EventArgs e)
EventHelpers.Raise(this, DeviceResetting, e);
}

internal void OnDeviceReset(EventArgs e)
/// <summary>
/// Called after a <see cref="Graphics.GraphicsDevice"/> is reset.
/// Raises the <see cref="DeviceReset"/> event.
/// </summary>
/// <param name="e"></param>
protected void OnDeviceReset(EventArgs e)
{
EventHelpers.Raise(this, DeviceReset, e);
}

internal void OnDeviceCreated(EventArgs e)
{
EventHelpers.Raise(this, DeviceCreated, e);
}

private void Raise<TEventArgs>(EventHandler<TEventArgs> handler, TEventArgs e)
where TEventArgs : EventArgs
{
if (handler != null)
handler(this, e);
}

#endregion

/// <summary>
/// Raised by <see cref="CreateDevice()"/> or <see cref="ApplyChanges"/>. Allows users
/// to override the <see cref="PresentationParameters"/> to pass to the
Expand Down Expand Up @@ -254,6 +254,8 @@ private GraphicsDeviceInformation DoPreparingDeviceSettings()
return gdi;
}

#endregion

#region IDisposable Members

public void Dispose()
Expand Down
32 changes: 16 additions & 16 deletions MonoGame.Framework/Matrix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ public Matrix(Vector4 row1, Vector4 row2, Vector4 row3, Vector4 row4)

#region Indexers

/// <summary>
/// Get or set the matrix element at row index / 4 and column index % 4.
/// </summary>
/// <param name="index">The linearized, zero-based index of the matrix element.</param>
/// <exception cref="ArgumentOutOfRangeException">
/// If the index is less than <code>0</code> or larger than <code>15</code>.
/// </exception>
/// <summary>
/// Get or set the matrix element at the given index, indexed in row major order.
/// </summary>
/// <param name="index">The linearized, zero-based index of the matrix element.</param>
/// <exception cref="ArgumentOutOfRangeException">
/// If the index is less than <code>0</code> or larger than <code>15</code>.
/// </exception>
public float this[int index]
{
get
Expand Down Expand Up @@ -246,14 +246,14 @@ public float this[int index]
}
}

/// <summary>
/// Get or set the index at the specified row and column (indices are zero-based).
/// </summary>
/// <param name="row">The row of the element.</param>
/// <param name="column">The column of the element.</param>
/// <exception cref="ArgumentOutOfRangeException">
/// If the row or column is less than <code>0</code> or larger than <code>3</code>.
/// </exception>
/// <summary>
/// Get or set the value at the specified row and column (indices are zero-based).
/// </summary>
/// <param name="row">The row of the element.</param>
/// <param name="column">The column of the element.</param>
/// <exception cref="ArgumentOutOfRangeException">
/// If the row or column is less than <code>0</code> or larger than <code>3</code>.
/// </exception>
public float this[int row, int column]
{
get
Expand Down Expand Up @@ -1011,7 +1011,7 @@ public static Matrix CreatePerspectiveOffCenter(float left, float right, float b
CreatePerspectiveOffCenter(left, right, bottom, top, nearPlaneDistance, farPlaneDistance, out result);
return result;
}


/// <summary>
/// Creates a new projection <see cref="Matrix"/> for customized perspective view.
/// </summary>
Expand Down
Loading

0 comments on commit 24ae11f

Please sign in to comment.