Skip to content

Commit

Permalink
Update v2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
EmptyKeys committed Aug 1, 2016
1 parent 067e894 commit fe8d7a4
Show file tree
Hide file tree
Showing 30 changed files with 1,038 additions and 90 deletions.
8 changes: 8 additions & 0 deletions EmptyKeys.UserInterface.Core/AssetManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,13 @@ public AssetManager()
/// <param name="file">The file.</param>
/// <returns></returns>
public abstract SoundBase LoadSound(object contentManager, string file);

/// <summary>
/// Loads the effect.
/// </summary>
/// <param name="contentManager">The content manager.</param>
/// <param name="file">The file.</param>
/// <returns></returns>
public abstract EffectBase LoadEffect(object contentManager, string file);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
<Compile Include="Media\AudioDevice.cs" />
<Compile Include="Media\Colors.cs" />
<Compile Include="Media\ColorW.cs" />
<Compile Include="Media\EffectBase.cs" />
<Compile Include="Media\FontBase.cs" />
<Compile Include="Media\FontEffectType.cs" />
<Compile Include="Media\GeometryBuffer.cs" />
<Compile Include="Media\GeometryPrimitiveType.cs" />
<Compile Include="Media\GradientSpreadMethod.cs" />
Expand Down
2 changes: 1 addition & 1 deletion EmptyKeys.UserInterface.Core/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static Engine Instance
/// <value>
/// The input device.
/// </value>
public abstract InputDeviceBase InputDevice { get; }
public abstract InputDeviceBase InputDevice { get; }

/// <summary>
/// Initializes a new instance of the <see cref="Engine"/> class.
Expand Down
33 changes: 33 additions & 0 deletions EmptyKeys.UserInterface.Core/Media/EffectBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EmptyKeys.UserInterface.Media
{
/// <summary>
/// Implements abstract Effect
/// </summary>
public abstract class EffectBase
{
/// <summary>
/// Initializes a new instance of the <see cref="EffectBase"/> class.
/// </summary>
/// <param name="nativeEffect">The native effect.</param>
public EffectBase(object nativeEffect)
{
}

/// <summary>
/// Gets the native effect.
/// </summary>
/// <returns></returns>
public abstract object GetNativeEffect();

/// <summary>
/// Updates the effect parameters.
/// </summary>
/// <param name="parameters">The parameters.</param>
public abstract void UpdateEffectParameters(params object[] parameters);
}
}
8 changes: 8 additions & 0 deletions EmptyKeys.UserInterface.Core/Media/FontBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ public abstract class FontBase
/// </value>
public abstract float Spacing { get; set; }

/// <summary>
/// Gets or sets the type of the effect.
/// </summary>
/// <value>
/// The type of the effect.
/// </value>
public abstract FontEffectType EffectType { get; }

/// <summary>
/// Initializes a new instance of the <see cref="FontBase"/> class.
/// </summary>
Expand Down
23 changes: 23 additions & 0 deletions EmptyKeys.UserInterface.Core/Media/FontEffectType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EmptyKeys.UserInterface.Media
{
/// <summary>
/// Describes font effect
/// </summary>
public enum FontEffectType
{
/// <summary>
/// No effect needed, this is standard sprite font
/// </summary>
None,

/// <summary>
/// Signed Distance Field font type
/// </summary>
SDF
}
}
30 changes: 28 additions & 2 deletions EmptyKeys.UserInterface.Core/Renderers/Renderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,34 @@ public abstract bool IsFullScreen
/// </summary>
public abstract void Begin();

/// <summary>
/// Begins the rendering with custom effect
/// </summary>
/// <param name="effect">The effect.</param>
public abstract void Begin(EffectBase effect);

/// <summary>
/// Ends rendering
/// </summary>
public abstract void End();
public abstract void End(bool endEffect = false);

/// <summary>
/// Begins the clipped rendering
/// </summary>
/// <param name="clipRect">The clip rect.</param>
public abstract void BeginClipped(Rect clipRect);

/// <summary>
/// Begins the clipped rendering with custom effect
/// </summary>
/// <param name="clipRect">The clip rect.</param>
/// <param name="effect">The effect.</param>
public abstract void BeginClipped(Rect clipRect, EffectBase effect);

/// <summary>
/// Ends the clipped rendering
/// </summary>
public abstract void EndClipped();
public abstract void EndClipped(bool endEffect = false);

/// <summary>
/// Determines whether the specified rectangle is outside of clip bounds
Expand Down Expand Up @@ -164,5 +177,18 @@ public abstract bool IsFullScreen
/// Resets the size of the native. Sets NativeScreenWidth and NativeScreenHeight based on active back buffer
/// </summary>
public abstract void ResetNativeSize();

/// <summary>
/// Creates the effect.
/// </summary>
/// <param name="nativeEffect">The native effect.</param>
/// <returns></returns>
public abstract EffectBase CreateEffect(object nativeEffect);

/// <summary>
/// Gets the SDF font effect.
/// </summary>
/// <returns></returns>
public abstract EffectBase GetSDFFontEffect();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<Compile Include="Media\FNAAudioDevice.cs" />
<Compile Include="Media\FNASound.cs" />
<Compile Include="FNAEngine.cs" />
<Compile Include="Media\FNAEffect.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Renderers\FNARenderer.cs" />
<Compile Include="FNAAssetManager.cs" />
Expand Down
22 changes: 22 additions & 0 deletions EmptyKeys.UserInterface.FNA/FNAAssetManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,27 @@ public override SoundBase LoadSound(object contentManager, string file)
SoundEffect native = database.Load<SoundEffect>(file);
return Engine.Instance.AudioDevice.CreateSound(native);
}

/// <summary>
/// Loads the effect.
/// </summary>
/// <param name="contentManager">The content manager.</param>
/// <param name="file">The file.</param>
/// <returns></returns>
public override EffectBase LoadEffect(object contentManager, string file)
{
ContentManager database = contentManager as ContentManager;
Effect native = null;
try
{
native = database.Load<Effect>(file);
}
catch (Exception)
{
// some built-in effects are not implemented yet
}

return Engine.Instance.Renderer.CreateEffect(native);
}
}
}
44 changes: 44 additions & 0 deletions EmptyKeys.UserInterface.FNA/Media/FNAEffect.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework.Graphics;

namespace EmptyKeys.UserInterface.Media
{
/// <summary>
/// Implements FNA specific effect
/// </summary>
/// <seealso cref="EmptyKeys.UserInterface.Media.EffectBase" />
public class FNAEffect : EffectBase
{
private Effect effect;

/// <summary>
/// Initializes a new instance of the <see cref="FNAEffect"/> class.
/// </summary>
/// <param name="nativeEffect">The native effect.</param>
public FNAEffect(object nativeEffect) : base(nativeEffect)
{
effect = nativeEffect as Effect;
}

/// <summary>
/// Gets the native effect.
/// </summary>
/// <returns></returns>
public override object GetNativeEffect()
{
return effect;
}

/// <summary>
/// Updates the effect parameters.
/// </summary>
/// <param name="parameters">The parameters.</param>
public override void UpdateEffectParameters(params object[] parameters)
{
}
}
}
15 changes: 15 additions & 0 deletions EmptyKeys.UserInterface.FNA/Media/FNAFont.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ public override float Spacing
}
}

/// <summary>
/// Gets or sets the type of the effect.
/// </summary>
/// <value>
/// The type of the effect.
/// </value>
/// <exception cref="System.NotImplementedException"></exception>
public override FontEffectType EffectType
{
get
{
return FontEffectType.None;
}
}

/// <summary>
/// Initializes a new instance of the <see cref="FNAFont" /> class.
/// </summary>
Expand Down
Loading

0 comments on commit fe8d7a4

Please sign in to comment.