本文整理汇总了C#中System.Single类的典型用法代码示例。如果您正苦于以下问题:C# Single类的具体用法?C# Single怎么用?C# Single使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Single类属于System命名空间,在下文中一共展示了Single类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BigPointsAwardedEvent
public BigPointsAwardedEvent(Int32 score, Single x, Single y, Boolean increasesMultiplier)
{
this.Score = score;
this.X = x;
this.Y = y;
this.IncreasesMultiplier = increasesMultiplier;
}
示例2: Encode
public static void Encode(Stream stream, Single val)
{
byte[] buf = BitConverter.GetBytes(val);
if (EncodingHelpers.Endian != EndianTypes.LittleEndian)
EncodingHelpers.ReverseBytes(buf);
stream.Write(buf, 0, buf.Length);
}
示例3: Play
/// <summary>
/// Plays a sound.
/// </summary>
/// <param name="id">The ChannelId identifing the SoundManger playing the sound and the channel number.</param>
/// <param name="buffer">A SecondaryBuffer containing the sound to be playing.</param>
/// <param name="frequencymultiplier">The multiplier applied the sound to change its pitch. 1.0f for no change.</param>
/// <param name="looping">Whether the sound should loop automatically until stopped.</param>
/// <param name="volume">The volume level of the sound.</param>
public void Play(ChannelId id, SecondaryBuffer buffer, Single frequencymultiplier, Boolean looping, Int32 volume)
{
if (buffer == null) throw new ArgumentNullException("buffer");
if (volume > (Int32)Volume.Max || volume < (Int32)Volume.Min) throw new ArgumentOutOfRangeException("volume");
Stop();
m_usingid = id;
m_buffer = buffer;
BufferPlayFlags flags = (looping == true) ? BufferPlayFlags.Looping : BufferPlayFlags.Default;
m_buffer.Frequency = (Int32)(m_buffer.Frequency * frequencymultiplier);
m_buffer.SetCurrentPosition(0);
m_buffer.Pan = (Int32)Pan.Center;
m_buffer.Volume = volume;
m_playflags = flags;
try
{
m_buffer.Play(0, flags);
}
catch { }
}
示例4: UnSerialize
public override void UnSerialize(XElement elem)
{
FirstStateSlot = (Byte)(Int32)elem.Attribute("slot");
var autoComp = elem.Element("AutoComplete");
if (autoComp != null && !autoComp.IsEmpty)
AutoComplete = (Int32)autoComp != 0;
var autoCompDist = elem.Element("AutoCompleteDistance");
if (autoCompDist != null && !autoCompDist.IsEmpty)
AutoCompleteDistance = (Single)autoCompDist;
var autoFail = elem.Element("AutoFail");
if (autoFail != null && !autoFail.IsEmpty)
AutoFail = (Int32)autoFail != 0;
var autoFailDist = elem.Element("AutoFailDistance");
if (autoFailDist != null && !autoFailDist.IsEmpty)
AutoFailDistance = (Single)autoFailDist;
var contId = elem.Element("ContinentCBID");
if (contId != null && !contId.IsEmpty)
ContinentId = (Int32)contId;
var laps = elem.Element("Laps");
if (laps != null && !laps.IsEmpty)
Laps = (Int32)laps;
foreach (var el in elem.Elements("GenericTargetCOID"))
if (TargetCount < 10)
GenericTargets[TargetCount++] = (Int64)el;
}
示例5: PanelDragEvent
public PanelDragEvent(Single positionX, Single positionY, Single deltaX, Single deltaY)
{
this.PositionX = positionX;
this.PositionY = positionY;
this.DeltaX = deltaX;
this.DeltaY = deltaY;
}
示例6: NumericDialog
public NumericDialog(Single currentValue)
: this()
{
this.numericUpDown1.Maximum = decimal.MaxValue;
this.numericUpDown1.Minimum = decimal.MinValue;
this.numericUpDown1.Value = Convert.ToDecimal(currentValue);
}
示例7: ColourChanger
public ColourChanger()
{
_current = RandomGenerator.Default.GetRandomColour();
_target = RandomGenerator.Default.GetRandomColour();
_colourChangeTime = RandomGenerator.Default.GetRandomSingle(3f, 10f);
_timer = _colourChangeTime;
}
示例8: RectangleF
public RectangleF(Single x, Single y, Single width, Single height)
{
this.X = x;
this.Y = y;
this.Width = width;
this.Height = height;
}
示例9: QuaternionReading
public QuaternionReading(Single w, Single x, Single y, Single z)
{
W = w;
X = x;
Y = y;
Z = z;
}
示例10: ShouldBe
/// <summary>
/// Asserts that this vector should have the specified components.
/// </summary>
/// <param name="x">The expected x-component.</param>
/// <param name="y">The expected y-component.</param>
/// <param name="z">The expected z-component.</param>
/// <returns>The result object.</returns>
public Vector3Result ShouldBe(Single x, Single y, Single z)
{
Assert.AreEqual(x, Value.X, delta);
Assert.AreEqual(y, Value.Y, delta);
Assert.AreEqual(z, Value.Z, delta);
return this;
}
示例11: Process
protected internal override void Process(Single deltaSeconds, ref ParticleIterator iterator)
#endif
{
Single deltaStrength = this.Strength * deltaSeconds;
Single deltaGravityX = this.GravityVector.X * deltaStrength;
Single deltaGravityY = this.GravityVector.Y * deltaStrength;
Single deltaGravityZ = this.GravityVector.Z * deltaStrength;
var particle = iterator.First;
do
{
#if UNSAFE
particle->Velocity.X += deltaGravityX;
particle->Velocity.Y += deltaGravityY;
particle->Velocity.Z += deltaGravityZ;
#else
particle.Velocity.X += deltaGravityX;
particle.Velocity.Y += deltaGravityY;
particle.Velocity.Z += deltaGravityZ;
#endif
}
#if UNSAFE
while (iterator.MoveNext(&particle));
#else
while (iterator.MoveNext(ref particle));
#endif
}
示例12: DrawVWall
public DrawVWall(Single newPosX, Single newPosY, Single newWidth, Single newHeight)
{
posX = newPosX;
posY = newPosY;
width = newWidth;
height = newHeight;
}
示例13: DBSpecific
internal static object DBSpecific(string key, Single single)
{
object retVal = null;
DatabaseSpecific dext = new DatabaseSpecific();
if (key == DatabaseSpecific.EXTENDED_PROPERTIES)
{
if (single is IColumn)
{
retVal = dext.ExtendedProperties(single as IColumn);
}
else if (single is ITable)
{
retVal = dext.ExtendedProperties(single as ITable);
}
else if (single is IProcedure)
{
retVal = dext.ExtendedProperties(single as IProcedure);
}
else if (single is IView)
{
retVal = dext.ExtendedProperties(single as IView);
}
}
return retVal;
}
示例14: UpdateRow
public void UpdateRow(CategoryEntity category, Single fontSize, SizeF imageViewSize)
{
LabelView.Text = category.Name;
if (category.Picture != null && category.Picture != "BsonNull")
{
try
{
var webClient = new WebClient();
webClient.DownloadDataCompleted += (s, e) =>
{
var bytes = e.Result; // get the downloaded data
ImageView.Image = ImageHandler.BytesToImage(bytes); // convert the data to an actual image
};
webClient.DownloadDataAsync(new Uri(category.Picture));
}
catch (Exception ex)
{
Console.WriteLine("Something went wrong loading image for cell..." + ex.Message);
}
}
LabelView.Font = UIFont.FromName("HelveticaNeue-Bold", fontSize);
ImageView.Frame = new RectangleF(0, 0, imageViewSize.Width, imageViewSize.Height);
// Position category label below image
LabelView.Frame = new RectangleF(0, (float) ImageView.Frame.Bottom+60, imageViewSize.Width, (float) (ContentView.Frame.Height - ImageView.Frame.Bottom));
}
示例15: LightingManager
static LightingManager()
{
ambientLightColour = Rgba32.Black;
emissiveColour = Rgba32.DarkSlateGrey;
specularColour = Rgba32.DarkGrey;
specularPower = 2f;
fogEnabled = true;
fogStart = 100f;
fogEnd = 1000f;
fogColour = Rgba32.BlueViolet;
dirLight0Direction = new Vector3(-0.3f, -0.9f, +0.3f);
Vector3.Normalise(ref dirLight0Direction, out dirLight0Direction);
dirLight0DiffuseColour = Rgba32.DimGrey;
dirLight0SpecularColour = Rgba32.DarkGreen;
dirLight1Direction = new Vector3(0.3f, 0.1f, -0.3f);
Vector3.Normalise(ref dirLight1Direction, out dirLight1Direction);
dirLight1DiffuseColour = Rgba32.DimGrey;
dirLight1SpecularColour = Rgba32.DarkRed;
dirLight2Direction = new Vector3( -0.7f, -0.3f, +0.1f);
Vector3.Normalise(ref dirLight2Direction, out dirLight2Direction);
dirLight2DiffuseColour = Rgba32.DimGrey;
dirLight2SpecularColour = Rgba32.DarkBlue;
}