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
This commit is contained in:
LaurentGom 2011-01-29 16:35:26 +00:00
parent f3b1cfd0de
commit f7427fe167

View File

@ -43,17 +43,18 @@ namespace SFML
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// <summary> /// <summary>
/// Load the shader from a text in memory /// Create a new shader from a text in memory
/// </summary> /// </summary>
/// <param name="shader">String containing the shader code</param> /// <param name="shader">String containing the shader code</param>
/// <exception cref="LoadingFailedException" /> /// <exception cref="LoadingFailedException" />
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
public void LoadFromString(string shader) public static Shader FromString(string shader)
{ {
SetThis(sfShader_CreateFromMemory(shader)); IntPtr ptr = sfShader_CreateFromMemory(shader);
if (ptr == IntPtr.Zero)
if (This == IntPtr.Zero)
throw new LoadingFailedException("shader"); throw new LoadingFailedException("shader");
return new Shader(ptr);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -204,6 +205,17 @@ namespace SFML
Context.Global.SetActive(false); Context.Global.SetActive(false);
} }
////////////////////////////////////////////////////////////
/// <summary>
/// Construct the shader from a pointer
/// </summary>
/// <param name="ptr">Pointer to the shader instance</param>
////////////////////////////////////////////////////////////
public Shader(IntPtr ptr) :
base(ptr)
{
}
Dictionary<string, Image> myTextures = new Dictionary<string, Image>(); Dictionary<string, Image> myTextures = new Dictionary<string, Image>();
#region Imports #region Imports