Holidays 12.10. -> 25.10.2020

~ Moved code around in files.

SM.Base:
+ PostProcessing-system
+ OnInitialization() for Scenes.
+ Shader-Extensions
+ Added option to not react while unfocused to the window.
+ Added Screenshots to the window.
+ Connected the log system to the SM.OGL-action system.

~ Replaced IShader with abstract MaterialShader.
~ When a log compression folder doesn't exist, it will create one.

SM.OGL:
+ Added support for UniformArrays
+ Added ShaderPreProcessing
+ Added Shader Extensions.
+ Added Debug actions.
+ SM.OGL settings

~ Framebuffer Size is automaticly changed, when the window and scale is set.

SM2D:
+ Added easy shader drawing.
This commit is contained in:
Michel Fedde 2020-10-24 15:10:36 +02:00
parent 2c00dbd31a
commit 03b3942732
102 changed files with 2683 additions and 1398 deletions

View file

@ -1,10 +1,14 @@
using System;
#region usings
using System;
using SM.Base.Contexts;
#endregion
namespace SM.Base.Time
{
/// <summary>
/// Performs intervals.
/// Performs intervals.
/// </summary>
public class Interval : Timer
{
@ -24,13 +28,14 @@ namespace SM.Base.Time
protected override void Stopping(UpdateContext context)
{
TriggerEndAction(context);
if (_stop){base.Stop();}
if (_stop)
base.Stop();
else Reset();
}
/// <summary>
/// This will tell the interval to stop after the next iteration.
/// <para>To stop immediately use <see cref="Cancel"/></para>
/// This will tell the interval to stop after the next iteration.
/// <para>To stop immediately use <see cref="Cancel" /></para>
/// </summary>
public override void Stop()
{
@ -38,7 +43,7 @@ namespace SM.Base.Time
}
/// <summary>
/// This will stop the interval immediately.
/// This will stop the interval immediately.
/// </summary>
public void Cancel()
{

View file

@ -1,22 +1,26 @@
using System.Collections.Generic;
#region usings
using System.Collections.Generic;
using SM.Base.Contexts;
#endregion
namespace SM.Base.Time
{
/// <summary>
/// Represents a stopwatch.
/// Represents a stopwatch.
/// </summary>
public class Stopwatch
{
private static List<Stopwatch> _activeStopwatches = new List<Stopwatch>();
/// <summary>
/// Contains how much time already has passed. (in seconds)
/// Contains how much time already has passed. (in seconds)
/// </summary>
public float Elapsed { get; private set; }
/// <summary>
/// Starts the stopwatch.
/// Starts the stopwatch.
/// </summary>
public virtual void Start()
{
@ -24,7 +28,7 @@ namespace SM.Base.Time
}
/// <summary>
/// Performs a tick.
/// Performs a tick.
/// </summary>
/// <param name="context"></param>
private protected virtual void Tick(UpdateContext context)
@ -33,7 +37,7 @@ namespace SM.Base.Time
}
/// <summary>
/// Stops the stopwatch.
/// Stops the stopwatch.
/// </summary>
public virtual void Stop()
{
@ -41,7 +45,7 @@ namespace SM.Base.Time
}
/// <summary>
/// Resets the stopwatch.
/// Resets the stopwatch.
/// </summary>
public void Reset()
{
@ -50,10 +54,7 @@ namespace SM.Base.Time
internal static void PerformTicks(UpdateContext context)
{
for (var i = 0; i < _activeStopwatches.Count; i++)
{
_activeStopwatches[i].Tick(context);
}
for (var i = 0; i < _activeStopwatches.Count; i++) _activeStopwatches[i].Tick(context);
}
}
}

View file

@ -1,31 +1,19 @@
using System;
using System.Collections.Generic;
#region usings
using System;
using SM.Base.Contexts;
#endregion
namespace SM.Base.Time
{
/// <summary>
/// Timer-System
/// Timer-System
/// </summary>
public class Timer : Stopwatch
{
/// <summary>
/// The target time in seconds.
/// </summary>
public float Target { get; private set; }
/// <summary>
/// The already elapsed time but normalized to the target.
/// </summary>
public float ElapsedNormalized { get; private set; }
/// <summary>
/// The event, that is triggered when the timer stops.
/// </summary>
public event Action<Timer, UpdateContext> EndAction;
/// <summary>
/// Creates a timer with specified seconds.
/// Creates a timer with specified seconds.
/// </summary>
/// <param name="seconds"></param>
public Timer(float seconds)
@ -34,14 +22,29 @@ namespace SM.Base.Time
}
/// <summary>
/// Creates a timer with a time span.
/// Creates a timer with a time span.
/// </summary>
/// <param name="timeSpan"></param>
public Timer(TimeSpan timeSpan)
{
Target = (float)timeSpan.TotalSeconds;
Target = (float) timeSpan.TotalSeconds;
}
/// <summary>
/// The target time in seconds.
/// </summary>
public float Target { get; private set; }
/// <summary>
/// The already elapsed time but normalized to the target.
/// </summary>
public float ElapsedNormalized { get; private set; }
/// <summary>
/// The event, that is triggered when the timer stops.
/// </summary>
public event Action<Timer, UpdateContext> EndAction;
/// <inheritdoc />
public override void Start()
{
@ -58,15 +61,16 @@ namespace SM.Base.Time
}
/// <summary>
/// Occurs, when the timer tries to stop.
/// Occurs, when the timer tries to stop.
/// </summary>
protected virtual void Stopping(UpdateContext context)
{
EndAction?.Invoke(this, context);
Stop();
}
/// <summary>
/// This will trigger <see cref="EndAction"/>
/// This will trigger <see cref="EndAction" />
/// </summary>
/// <param name="context"></param>
protected void TriggerEndAction(UpdateContext context)