Struttura FixedPoint
Aggiornamento: novembre 2007
Rappresenta un numero in virgola fissa 16.16.
Spazio dei nomi: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in Microsoft.WindowsMobile.DirectX.dll)
Sintassi
'Dichiarazione
Public Structure FixedPoint _
Implements IComparable, IFormattable, IConvertible
'Utilizzo
Dim instance As FixedPoint
public struct FixedPoint : IComparable,
IFormattable, IConvertible
public value class FixedPoint : IComparable,
IFormattable, IConvertible
JScript supporta l'utilizzo di strutture ma non la dichiarazione di nuove.
Note
Questa struttura consente di interagire con i diversi tipi presenti in Windows Mobile Direct 3D che presentano interfacce in virgola fissa. La rappresentazione interna di questa classe è una struttura Int32.
Esempi
Nell'esempio riportato di seguito viene illustrato come utilizzare una struttura FixedPoint.
' The following code is from the
' Direct3D Mobile Fixed Point Billboard Sample.
' It uses FixedPoint to position meshes of trees randomly.
' Initialize the tree data
Dim i As Integer
For i = 0 To numberTrees - 1
Dim t As New Tree()
' Position the trees randomly
Do
Dim fTheta As Single = 2.0F * _
System.Convert.ToSingle(Math.PI) * _
System.Convert.ToSingle(randObj.NextDouble())
Dim fRadius As Single = 25.0F + 55.0F * _
System.Convert.ToSingle(randObj.NextDouble())
Dim position As Vector3Fixed
position.X = CType(fRadius * _
System.Convert.ToSingle( _
Math.Sin(fTheta)), FixedPoint)
position.Z = CType(fRadius * _
System.Convert.ToSingle(Math.Cos(fTheta)), FixedPoint)
position.Y = CType(HeightField( _
System.Convert.ToSingle(position.X), _
System.Convert.ToSingle(position.Z)), FixedPoint)
t.Position = position
Loop While Not IsTreePositionValid(t.Position)
// The following code is from the
// Direct3D Mobile Fixed Point Billboard Sample.
// It uses FixedPoint to position meshes of trees randomly.
// Initialize the tree data
for (int i=0; i<numberTrees; i++)
{
Tree t = new Tree();
do
{
float fTheta = 2.0f * (float)Math.PI *
(float)randObj.NextDouble();
float fRadius = 25.0f + 55.0f * (float)randObj.NextDouble();
Vector3Fixed position;
position.X =
(FixedPoint)(fRadius * (float)Math.Sin(fTheta));
position.Z =
(FixedPoint)(fRadius * (float)Math.Cos(fTheta));
position.Y =
(FixedPoint)HeightField((float)position.X,
(float)position.Z);
t.Position = position;
}
while (!IsTreePositionValid(t.Position));
Codice thread safe
Qualsiasi membro static (Shared in Visual Basic) pubblico di questo tipo è thread-safe. I membri di istanza non sono garantiti come thread-safe.
Piattaforme
Windows CE, Windows Mobile per Smartphone, Windows Mobile per Pocket PC
.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.
Informazioni sulla versione
.NET Compact Framework
Supportato in: 3.5, 2.0
Vedere anche
Riferimenti
Spazio dei nomi Microsoft.WindowsMobile.DirectX.Direct3D
Altre risorse
Programmazione per Mobile Direct3D in .NET Compact Framework