FS#145 - Implement copy constructors and ToString functions in SFML.Net
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1330 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
bd9a60fef2
commit
dd255a916d
28 changed files with 627 additions and 0 deletions
|
@ -215,6 +215,29 @@ namespace SFML
|
|||
set {sfMusic_SetPlayingOffset(This, value);}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[Music]" +
|
||||
" SampleRate = " + SampleRate +
|
||||
" ChannelsCount = " + ChannelsCount +
|
||||
" Status = " + Status +
|
||||
" Duration = " + Duration +
|
||||
" Loop = " + Loop +
|
||||
" Pitch = " + Pitch +
|
||||
" Volume = " + Volume +
|
||||
" Position = " + Position +
|
||||
" RelativeToListener = " + RelativeToListener +
|
||||
" MinDistance = " + MinDistance +
|
||||
" Attenuation = " + Attenuation +
|
||||
" PlayingOffset = " + PlayingOffset;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Handle the destruction of the object
|
||||
|
|
|
@ -53,6 +53,18 @@ namespace SFML
|
|||
SoundBuffer = buffer;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the sound from another source
|
||||
/// </summary>
|
||||
/// <param name="copy">Sound to copy</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public Sound(Sound copy) :
|
||||
base(sfSound_Copy(copy.This))
|
||||
{
|
||||
SoundBuffer = copy.SoundBuffer;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Play the sound
|
||||
|
@ -198,6 +210,27 @@ namespace SFML
|
|||
set {sfSound_SetAttenuation(This, value);}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[Sound]" +
|
||||
" Status = " + Status +
|
||||
" Loop = " + Loop +
|
||||
" Pitch = " + Pitch +
|
||||
" Volume = " + Volume +
|
||||
" Position = " + Position +
|
||||
" RelativeToListener = " + RelativeToListener +
|
||||
" MinDistance = " + MinDistance +
|
||||
" Attenuation = " + Attenuation +
|
||||
" PlayingOffset = " + PlayingOffset +
|
||||
" SoundBuffer = " + SoundBuffer;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Handle the destruction of the object
|
||||
|
@ -215,6 +248,9 @@ namespace SFML
|
|||
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr sfSound_Create();
|
||||
|
||||
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr sfSound_Copy(IntPtr Sound);
|
||||
|
||||
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfSound_Destroy(IntPtr Sound);
|
||||
|
||||
|
|
|
@ -77,6 +77,17 @@ namespace SFML
|
|||
throw new LoadingFailedException("sound buffer");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Construct the sound buffer from another sound buffer
|
||||
/// </summary>
|
||||
/// <param name="copy">Sound buffer to copy</param>
|
||||
////////////////////////////////////////////////////////////
|
||||
public SoundBuffer(SoundBuffer copy) :
|
||||
base(sfSoundBuffer_Copy(copy.This))
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Save the sound buffer to an audio file
|
||||
|
@ -134,6 +145,20 @@ namespace SFML
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[SoundBuffer]" +
|
||||
" SampleRate = " + SampleRate +
|
||||
" ChannelsCount = " + ChannelsCount +
|
||||
" Duration = " + Duration;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Handle the destruction of the object
|
||||
|
@ -155,6 +180,9 @@ namespace SFML
|
|||
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
|
||||
unsafe static extern IntPtr sfSoundBuffer_CreateFromSamples(short* Samples, uint SamplesCount, uint ChannelsCount, uint SampleRate);
|
||||
|
||||
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
|
||||
static extern IntPtr sfSoundBuffer_Copy(IntPtr SoundBuffer);
|
||||
|
||||
[DllImport("csfml-audio"), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfSoundBuffer_Destroy(IntPtr SoundBuffer);
|
||||
|
||||
|
|
|
@ -28,6 +28,19 @@ namespace SFML
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[SoundBufferRecorder]" +
|
||||
" SampleRate = " + SampleRate +
|
||||
" SoundBuffer = " + SoundBuffer;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Called when a new capture starts
|
||||
|
|
|
@ -83,6 +83,18 @@ namespace SFML
|
|||
get {return sfSoundRecorder_IsAvailable();}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[SoundRecorder]" +
|
||||
" SampleRate = " + SampleRate;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Called when a new capture starts
|
||||
|
|
|
@ -180,6 +180,28 @@ namespace SFML
|
|||
set {sfSoundStream_SetPlayingOffset(This, value);}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[SoundStream]" +
|
||||
" SampleRate = " + SampleRate +
|
||||
" ChannelsCount = " + ChannelsCount +
|
||||
" Status = " + Status +
|
||||
" Loop = " + Loop +
|
||||
" Pitch = " + Pitch +
|
||||
" Volume = " + Volume +
|
||||
" Position = " + Position +
|
||||
" RelativeToListener = " + RelativeToListener +
|
||||
" MinDistance = " + MinDistance +
|
||||
" Attenuation = " + Attenuation +
|
||||
" PlayingOffset = " + PlayingOffset;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Set the audio stream parameters, you must call it before Play()
|
||||
|
|
|
@ -106,6 +106,20 @@ namespace SFML
|
|||
return new Vector3(v.X / x, v.Y / x, v.Z / x);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Provide a string describing the object
|
||||
/// </summary>
|
||||
/// <returns>String description of the object</returns>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override string ToString()
|
||||
{
|
||||
return "[Vector3]" +
|
||||
" X = " + X +
|
||||
" Y = " + Y +
|
||||
" Z = " + Z;
|
||||
}
|
||||
|
||||
/// <summary>X (horizontal) component of the vector</summary>
|
||||
public float X;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue