Install
dotnet add package nkast.Xna.Framework.Devices --version 4.3.9001
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard |
README
Xna.Framework.Devices
Device sensor and haptic feedback support.
Overview
The Xna.Framework.Devices package provides access to device sensors and haptic feedback. It includes:
- Accelerometer: 3-axis acceleration measurement
- Compass: Magnetic heading and direction
- Haptics: Vibration and haptic feedback control
Installation
dotnet add package nkast.Xna.Framework.Devices
Quick Start
using Microsoft.Xna.Framework.Devices;
// Accelerometer input
if (Accelerometer.IsSupported)
{
Accelerometer.Initialize();
AccelerometerReading reading = Accelerometer.GetState();
Vector3 acceleration = reading.Acceleration;
Accelerometer.ReadingChanged += (s, e) =>
{
// Handle real-time acceleration changes
};
}
// Compass heading
if (Compass.IsSupported)
{
Compass.Initialize();
CompassReading reading = Compass.GetState();
float heading = reading.Heading;
}
// Haptic feedback
Haptics.SetVibration(1.0f); // Full vibration
Changes from Previous Version
No structural changes between v4.2.9001 and v4.3.9001.
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.