From f7427fe1675627b1184fe14bab4465f1e680b83e Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Sat, 29 Jan 2011 16:35:26 +0000 Subject: [PATCH] Renamed Shader.LoadFromFile to FromFile and made it static (so that now it is a named constructor), in SFML.Net git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1783 4e206d99-4929-0410-ac5d-dfc041789085 --- bindings/dotnet/src/Graphics/Shader.cs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/bindings/dotnet/src/Graphics/Shader.cs b/bindings/dotnet/src/Graphics/Shader.cs index 3817c9d1..97452d16 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