PistonDevelopers / input

DEPRECATED - moved into the piston repo
MIT License
7 stars 11 forks source link

Idea for unified mouse cursor, multitouch and motion tracking input #48

Open bvssvni opened 9 years ago

bvssvni commented 9 years ago

Change the Motion struct to the following:

pub enum Id {
    Point,
    Scroll,
    Touch(uint),
    Control(uint),
    Track(uint),
}

pub enum Motion {
    /// Normalized between 0 and 1 in the space of input receiver.
    /// Can exceed bounds, both under 0 and above 1.
    Absolute(Id, f64, f64, f64),
    /// Localized in the space of input sender.
    /// Can be negative.
    Relative(Id, f64, f64, f64),
    /// Normalized to unit sphere.
    /// Length is always 1.
    Oriented(Id, f64, f64, f64),
}
bvssvni commented 9 years ago

For example, the axis on a game controller can be Relative(Control(player), x, y, z).

bvssvni commented 9 years ago

For example, mouse position will become normalized Absolute(Point, x, y, z).