diff --git a/bindings/dotnet/src/Graphics/Shader.cs b/bindings/dotnet/src/Graphics/Shader.cs
index 3817c9d1e..97452d169 100644
--- a/bindings/dotnet/src/Graphics/Shader.cs
+++ b/bindings/dotnet/src/Graphics/Shader.cs
@@ -43,17 +43,18 @@ namespace SFML
////////////////////////////////////////////////////////////
///
- /// Load the shader from a text in memory
+ /// Create a new shader from a text in memory
///
/// String containing the shader code
///
////////////////////////////////////////////////////////////
- public void LoadFromString(string shader)
+ public static Shader FromString(string shader)
{
- SetThis(sfShader_CreateFromMemory(shader));
-
- if (This == IntPtr.Zero)
+ IntPtr ptr = sfShader_CreateFromMemory(shader);
+ if (ptr == IntPtr.Zero)
throw new LoadingFailedException("shader");
+
+ return new Shader(ptr);
}
////////////////////////////////////////////////////////////
@@ -204,6 +205,17 @@ namespace SFML
Context.Global.SetActive(false);
}
+ ////////////////////////////////////////////////////////////
+ ///
+ /// Construct the shader from a pointer
+ ///
+ /// Pointer to the shader instance
+ ////////////////////////////////////////////////////////////
+ public Shader(IntPtr ptr) :
+ base(ptr)
+ {
+ }
+
Dictionary myTextures = new Dictionary();
#region Imports