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

Commit

Permalink
Updated Exiting event
Browse files Browse the repository at this point in the history
  • Loading branch information
craftersmine committed Mar 4, 2019
1 parent 8193df4 commit 653db7c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions craftersmine.EtherEngine.Rendering/Window.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -83,6 +84,7 @@ public Window(string title, WindowSize windowSize, bool isFullscreen)
fpsBounds = new Rectangle(WindowSize.Width - 30, 0, 30, 30);

_gameWnd.Load += _gameWnd_Load;
_gameWnd.Closing += _gameWnd_Closing;
Keyboard.KeyboardDevice = _gameWnd.Keyboard;
Mouse.MouseDevice = _gameWnd.Mouse;
Mouse.MouseDevice.ButtonDown += Mouse.MouseDeviceButtonDownEvent;
Expand All @@ -91,6 +93,11 @@ public Window(string title, WindowSize windowSize, bool isFullscreen)
Mouse.MouseDevice.WheelChanged += Mouse.MouseDeviceWheelChangedEvent;
}

private void _gameWnd_Closing(object sender, CancelEventArgs e)
{
Exiting?.Invoke(this, e);
}

private void _gameWnd_Load(object sender, EventArgs e)
{
Load?.Invoke(this, e);
Expand Down Expand Up @@ -123,6 +130,11 @@ private void _gameWnd_RenderFrame(object sender, FrameEventArgs e)
/// </summary>
public event EventHandler Load;

/// <summary>
/// Occurs when close on window clicked
/// </summary>
public event EventHandler<CancelEventArgs> Exiting;

/// <summary>
/// Initializes and shows window and sets maximum framerate
/// </summary>
Expand Down

0 comments on commit 653db7c

Please sign in to comment.