Overview

A device component is an individual stateful part of a device, such as a button. All devices will be composed of one or more components.

Included Components

  • Button - A component that can be pushed into a down state and released into an up state.
  • Positional Component - A component that reports its position on a 2D plane, expressed in x and y coordinates. The coordinates range from (0.0, 0.0) top-left to (1.0, 1.0) bottom right.
  • Accelerometer - Reports the orientation of the device in 3D space. Each axis is measured from -1.0 to 1.0.
  • Delta - Reports a single unit of change in a device measured as a signed integer. The mouse wheel is represented by a delta device component.
  • Joystick - Reports the x and y axis of an analog joystick. Measured from (-1.0, -1.0) top-left to (1.0, 1.0) bottom right.
  • Trigger - Reports the position of an analog trigger from 0.0 (released) to 1.0 (fully pressed).

Extending Device Components

To add a new device component type inherit from the DeviceComponent base class. Properties should be added to represent any state of the device component. To get the gui to display the device state a component state user control should be created. To allow the user to map this component type to a gesture property a property setter user control should be created.

Sample

public class ButtonDeviceComponent : DeviceComponent
{
    public ButtonDeviceComponent(Device owner)
        : base (owner)
    {

    }

    public ButtonState State { get; set; }
}

Last edited Dec 2, 2009 at 12:38 AM by PhilipB, version 3

Comments

No comments yet.