Partager via


FixedPoint, structure

Mise à jour : novembre 2007

Représente un nombre à virgule fixe 16,16.

Espace de noms :  Microsoft.WindowsMobile.DirectX.Direct3D
Assembly :  Microsoft.WindowsMobile.DirectX (dans Microsoft.WindowsMobile.DirectX.dll)

Syntaxe

'Déclaration
Public Structure FixedPoint _
    Implements IComparable, IFormattable, IConvertible
'Utilisation
Dim instance As FixedPoint
public struct FixedPoint : IComparable, 
    IFormattable, IConvertible
public value class FixedPoint : IComparable, 
    IFormattable, IConvertible
JScript prend en charge l'utilisation de structures mais pas la déclaration de nouvelles structures.

Notes

Cette structure est utilisée pour interagir avec les différents types de Windows Mobile Direct 3D qui ont des interfaces à virgule fixe. La représentation interne de cette classe est une structure Int32.

Exemples

L'exemple de code suivant montre comment utiliser une structure 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));

Sécurité des threads

Tous les membres static (Shared en Visual Basic) publics de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.

Plateformes

Windows CE, Windows Mobile pour Smartphone, Windows Mobile pour Pocket PC

Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

Informations de version

.NET Compact Framework

Pris en charge dans : 3.5, 2.0

Voir aussi

Référence

Membres FixedPoint

Microsoft.WindowsMobile.DirectX.Direct3D, espace de noms

Autres ressources

Programmation Direct3D Mobile dans le .NET Compact Framework