Gui dialogs (#410)

* started refactoring for gui windows

* a bit more work on gui windows

* fixed some bugs and broken build stuff

* fixed some bugs in gui controls

* a little code cleanup

* got gui dialogs positioning and experimenting with named styles by type

* apply control styles directly in the constructor of controls

* got everything compiling again

* all gui controls have skinnable constructors

* rework uniform grid desired size calculations

* turns out gui layouts are complicated

* include pdb files in nuget packages

* fixed a bug in find nearest glyph

* custom control styling

* added a range constructor overload that takes one value

* rethinking control desired size behaviour

* made particle emitters more editable at runtime

* moved the auto trigger code to the particle effect instead of the emitters

* tweaks

* changed the particle modifer interface to an abstract base with an optional name

* changed the particle modifer interface to an abstract base with an optional name

* an attempt at creating a gui combo box

* rolled back the nested control experiment

* pretty good (but not perfect) combo boxes

* tweaks

* name property bindings on lists

* removed and cleaned up the hacks from the gui combo box

* minor combo box styling tweaks

* minor bug fix in gui combo box

* experiments with data binding

* fixed a mistake on the texture region service interface

* working on the ability to serialize particles

* finished particle serialization

* more robust range deserialization

* added editor browable attributes

* fixed some broken demos

* made the particle modifiers editable at runtime

* fixed some issues with particle serialization

* fixed some issues with interpolators
This commit is contained in:
Dylan Wilson
2017-07-22 21:22:13 +10:00
committed by GitHub
parent 98906f2873
commit b3a631aff5
111 changed files with 1629 additions and 820 deletions
@@ -1,41 +1,13 @@
using System;
using MonoGame.Extended;
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
{
/// <summary>
/// Defines a modifier which interpolates the color of a particle over the course of its lifetime.
/// Defines a modifier which interpolates the color of a particle over the course of its lifetime.
/// </summary>
public sealed class ColorInterpolator : IInterpolator<HslColor>
public sealed class ColorInterpolator : Interpolator<HslColor>
{
/// <summary>
/// Gets or sets the initial color of particles when they are released.
/// </summary>
public HslColor StartValue { get; set; }
/// <summary>
/// Gets or sets the final color of particles when they are retired.
/// </summary>
public HslColor EndValue { get; set; }
[Obsolete("Use StartValue instead")]
public HslColor InitialColor
{
get { return StartValue; }
set { StartValue = value; }
}
[Obsolete("Use EndValue instead")]
public HslColor FinalColor
{
get { return EndValue; }
set { EndValue = value; }
}
public unsafe void Update(float amount, Particle* particle)
public override unsafe void Update(float amount, Particle* particle)
{
particle->Color = HslColor.Lerp(StartValue, EndValue, amount);
}
}
}
@@ -2,18 +2,17 @@
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
{
public class HueInterpolator : IInterpolator
public class HueInterpolator : Interpolator<float>
{
private float _delta;
public float StartValue { get; set; }
public float EndValue
public override float EndValue
{
get { return _delta + StartValue; }
set { _delta = value - StartValue; }
}
public unsafe void Update(float amount, Particle* particle)
public override unsafe void Update(float amount, Particle* particle)
{
particle->Color = new HslColor(
amount*_delta + StartValue,
@@ -1,13 +0,0 @@
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
{
public interface IInterpolator
{
unsafe void Update(float amount, Particle* particle);
}
public interface IInterpolator<T> : IInterpolator
{
T StartValue { get; set; }
T EndValue { get; set; }
}
}
@@ -0,0 +1,26 @@
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
{
public abstract class Interpolator
{
protected Interpolator()
{
Name = GetType().Name;
}
public string Name { get; set; }
public abstract unsafe void Update(float amount, Particle* particle);
}
public abstract class Interpolator<T> : Interpolator
{
/// <summary>
/// Gets or sets the intial value when the particles are created.
/// </summary>
public virtual T StartValue { get; set; }
/// <summary>
/// Gets or sets the final value when the particles are retired.
/// </summary>
public virtual T EndValue { get; set; }
}
}
@@ -1,18 +1,16 @@
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
{
public class OpacityInterpolator : IInterpolator
public class OpacityInterpolator : Interpolator<float>
{
private float _delta;
public float StartValue { get; set; }
public float EndValue
public override float EndValue
{
get { return _delta + StartValue; }
set { _delta = value - StartValue; }
}
public unsafe void Update(float amount, Particle* particle)
public override unsafe void Update(float amount, Particle* particle)
{
particle->Opacity = _delta*amount + StartValue;
}
@@ -1,18 +1,16 @@
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
{
public class RotationInterpolator : IInterpolator
public class RotationInterpolator : Interpolator<float>
{
private float _delta;
public float StartValue { get; set; }
public float EndValue
public override float EndValue
{
get { return _delta + StartValue; }
set { _delta = value - StartValue; }
}
public unsafe void Update(float amount, Particle* particle)
public override unsafe void Update(float amount, Particle* particle)
{
particle->Rotation = amount*_delta + StartValue;
}
@@ -2,19 +2,17 @@
namespace MonoGame.Extended.Particles.Modifiers.Interpolators
{
public class ScaleInterpolator : IInterpolator
public class ScaleInterpolator : Interpolator<Vector2>
{
private Vector2 _delta;
public Vector2 StartValue { get; set; }
public Vector2 EndValue
public override Vector2 EndValue
{
get { return _delta + StartValue; }
set { _delta = value - StartValue; }
}
public unsafe void Update(float amount, Particle* particle)
public override unsafe void Update(float amount, Particle* particle)
{
particle->Scale = _delta*amount + StartValue;
}