XMFLOAT2 structure (directxmath.h)

A 2D vector consisting of two single-precision floating-point values.

For a list of additional functionality such as constructors and operators that are available using XMFLOAT2 when you are programming in C++, see XMFLOAT2 Extensions.

Note  See DirectXMath Library Type Equivalences for information about equivalent D3DDECLTYPE, D3DFORMAT, and DXGI_FORMAT objects.
 

Syntax

struct XMFLOAT2 {
  float      x;
  float      y;
  void       XMFLOAT2();
  void       XMFLOAT2(
    const XMFLOAT2 & unnamedParam1
  );
  XMFLOAT2 & operator=(
    const XMFLOAT2 & unnamedParam1
  );
  void       XMFLOAT2(
    XMFLOAT2 && unnamedParam1
  );
  XMFLOAT2 & operator=(
    XMFLOAT2 && unnamedParam1
  );
  void       XMFLOAT2(
    float _x,
    float _y
  ) noexcept;
  void       XMFLOAT2(
    const float *pArray
  ) noexcept;
  bool       operator==(
    const XMFLOAT2 & unnamedParam1
  );
  auto       operator<=>(
    const XMFLOAT2 & unnamedParam1
  );
};

Members

x

float value describing the x-coordinate of the vector.

y

float value describing the y-coordinate of the vector.

void XMFLOAT2()

Default constructor for XMFLOAT2.

Default constructor for XMFLOAT2.

Note  This constructor is only available under C++.
 

void XMFLOAT2( const XMFLOAT2 & unnamedParam1)

A constructor for XMFLOAT2.

A constructor for XMFLOAT2.

Note  This constructor is only available under C++.

XMFLOAT2 & operator=( const XMFLOAT2 & unnamedParam1)

Assigns the vector component data from one instance of XMFLOAT2 to the current instance of XMFLOAT2.

This operator assigns the vector component data from one instance of XMFLOAT2 to the current instance of XMFLOAT2.

Note  This operator is only available under C++.

void XMFLOAT2( XMFLOAT2 && unnamedParam1)

A constructor for XMFLOAT2.

A constructor for XMFLOAT2.

Note  This constructor is only available under C++.

XMFLOAT2 & operator=( XMFLOAT2 && unnamedParam1)

void XMFLOAT2( float _x, float _y) noexcept

Initializes a new instance of XMFLOAT2 from two float arguments.

This constructor initializes a new instance of XMFLOAT2 from two float arguments.

Note  This constructor is only available under C++.
 

void XMFLOAT2( const float *pArray) noexcept

Initializes a new instance of XMFLOAT2 from a two element float array argument.

This constructor initializes a new instance of XMFLOAT2 from a from a two element float array argument.

Note  This constructor is only available under C++.
 

bool operator==( const XMFLOAT2 & unnamedParam1)

auto operator<=>( const XMFLOAT2 & unnamedParam1)

Remarks

XMFLOAT2 can be loaded into instances of XMVECTOR by using XMLoadFloat2.

Instances of XMVECTOR can be stored into an instance of XMFLOAT2 with XMStoreFloat2.

Namespace: Use DirectX

Platform Requirements

Microsoft Visual Studio 2010 or Microsoft Visual Studio 2012 with the Windows SDK for Windows 8. Supported for Win32 desktop apps, Windows Store apps, and Windows Phone 8 apps.

Requirements

Requirement Value
Header directxmath.h

See also

DirectXMath Library Structures

XMFLOAT2 Extensions