Browse Source

Began implementing WindowEvents.

improved_timing
Ian Burgmyer 7 years ago
parent
commit
cb806338ab
  1. 2
      DotSDL/Events/EventHandler.cs
  2. 12
      DotSDL/Events/IEvent.cs
  3. 11
      DotSDL/Events/WindowEvent.cs
  4. 2
      DotSDL/Graphics/SdlWindow.cs

2
DotSDL/Events/EventDispatcher.cs → DotSDL/Events/EventHandler.cs

@ -4,7 +4,7 @@ namespace DotSDL.Events {
/// <summary>
/// Handles dispatching events to objects that can receive them.
/// </summary>
internal static class EventDispatcher {
internal static class EventHandler {
private static readonly ResourceManager Resources = ResourceManager.Instance;
/// <summary>

12
DotSDL/Events/IEvent.cs

@ -0,0 +1,12 @@
namespace DotSDL.Events {
/// <summary>
/// An interface describing a common DotSDL event.
/// </summary>
public interface IEvent {
/// <summary>
/// The timestamp of the event. Thsi is measured in milliseconds,
/// starting from when the application is first executed.
/// </summary>
uint Timestamp { get; set; }
}
}

11
DotSDL/Events/WindowEvent.cs

@ -0,0 +1,11 @@
namespace DotSDL.Events {
/// <summary>
/// Represents a window event. Window events are thrown when an event occurs
/// that affects an <see cref="DotSDL.Graphics.SdlWindow"/> instance and/or
/// the applicaiton as a whole. This includes the UI toolkit minimizing,
/// maximizing, and closing a window, as well as application quit messages.
/// </summary>
public class WindowEvent : IEvent {
public uint Timestamp { get; set; }
}
}

2
DotSDL/Graphics/SdlWindow.cs

@ -143,7 +143,7 @@ namespace DotSDL.Graphics {
private void BaseUpdate() {
if(IsDestroyed) return;
Events.EventDispatcher.ProcessEvents();
Events.EventHandler.ProcessEvents();
OnUpdate(); // Call the overridden Update function.
}

Loading…
Cancel
Save