diff --git a/examples/01.cs b/examples/01.cs
new file mode 100644
index 0000000..dc87c50
--- /dev/null
+++ b/examples/01.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TickManager
+{
+ class _01
+ {
+ public TickManager tick_manager = new TickManager();
+
+ public void Main()
+ {
+ tick_manager.OnTick += Tick_manager_OnTick;
+
+ while (true)
+ {
+ tick_manager.Tick();
+ }
+ }
+
+ private void Tick_manager_OnTick()
+ {
+ Console.WriteLine("MSPT: ");
+ Console.Write(tick_manager.MSPT);
+
+ Console.WriteLine("TPS: ");
+ Console.Write(tick_manager.TPS);
+ }
+ }
+}
diff --git a/src/TickManager.cs b/src/TickManager.cs
index 72e3698..f255cf1 100644
--- a/src/TickManager.cs
+++ b/src/TickManager.cs
@@ -4,6 +4,8 @@ using System.Text;
namespace TickManager
{
+ public delegate void Tick();
+
///
/// Handles ticking for an application
///
@@ -24,6 +26,20 @@ namespace TickManager
///
internal TickClock tc = new TickClock();
+ ///
+ /// Event that gets called every time it ticks
+ ///
+ public event Tick OnTick;
+
+ ///
+ /// Used to run in a loop. Invokes the OnTick event
+ ///
+ public void Tick()
+ {
+ if (CanTick())
+ OnTick?.Invoke();
+ }
+
///
/// The frequency your application will tick
///
@@ -55,7 +71,7 @@ namespace TickManager
/// Checks if the application can process the same tick relative to the frequency set
///
/// Whether the application should process the next tick or not
- public bool CanTick()
+ internal bool CanTick()
{
double tickTime = tc.Tick();
bool canTick = tickTime > msptInternal;