Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.

Commit

Permalink
Changed sealed to static class, GameExited to GameExiting name and up…
Browse files Browse the repository at this point in the history
…dated documentation
  • Loading branch information
craftersmine committed Mar 2, 2019
1 parent d646d8e commit 79e6a04
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions craftersmine.EtherEngine.Core/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,30 @@

namespace craftersmine.EtherEngine.Core
{
public sealed class Game
/// <summary>
/// Provides static methods to manage game
/// </summary>
public static class Game
{
internal static Window GameWnd { get; private set; }
internal static GLGDI GLGDIInstance { get { return GameWnd.GLGDI; } }
internal static GameUpdater GameUpdater { get; private set; }
internal static CollisionUpdater CollisionUpdater { get; private set; }
internal static string DefaultWindowTitle { get; private set; }

/// <summary>
/// Occurs when game started and ready to show scene
/// </summary>
public static event EventHandler GameStarted;
public static event EventHandler GameExited;
/// <summary>
/// Occurs when game exiting
/// </summary>
public static event EventHandler GameExiting;

/// <summary>
/// Starts game instance with specified <see cref="Window"/>
/// </summary>
/// <param name="gameWindow">Main game <see cref="Window"/></param>
public static void Run(Window gameWindow)
{
try
Expand Down Expand Up @@ -57,9 +70,13 @@ private static void GameWnd_Load(object sender, EventArgs e)
GameStarted?.Invoke(null, EventArgs.Empty);
}

/// <summary>
/// Exits from game with specified exit code
/// </summary>
/// <param name="exitCode">Game exit code</param>
public static void Exit(int exitCode)
{
GameExited?.Invoke(null, EventArgs.Empty);
GameExiting?.Invoke(null, EventArgs.Empty);
if (GameWnd != null)
GameWnd.Close();

Expand Down

0 comments on commit 79e6a04

Please sign in to comment.