Blame mono/Assistance/TrackPoint.cs
|
|
b82ef4 |
using System;
|
|
|
b82ef4 |
|
|
|
b82ef4 |
namespace Assistance {
|
|
|
b82ef4 |
public struct TrackPoint {
|
|
|
b82ef4 |
public Point point;
|
|
|
b82ef4 |
public double time;
|
|
|
b82ef4 |
public double pressure;
|
|
|
b82ef4 |
public Point tilt;
|
|
|
c66393 |
|
|
|
c66393 |
public KeyState<gdk.key>.Holder keyState;</gdk.key>
|
|
|
c66393 |
public KeyState<uint>.Holder buttonState;</uint>
|
|
|
c66393 |
|
|
|
c66393 |
public TrackPoint spawn(Point point, double time, double pressure, Point tilt) {
|
|
|
c66393 |
TrackPoint p = this;
|
|
|
c66393 |
p.point = point;
|
|
|
c66393 |
p.time = time;
|
|
|
c66393 |
p.pressure = pressure;
|
|
|
c66393 |
p.tilt = tilt;
|
|
|
c66393 |
p.keyState.timeOffset += time - this.time;
|
|
|
c66393 |
p.buttonState.timeOffset += time - this.time;
|
|
|
c66393 |
return p;
|
|
|
b82ef4 |
}
|
|
|
b82ef4 |
|
|
|
b82ef4 |
public static TrackPoint operator+ (TrackPoint a, TrackPoint b)
|
|
|
c66393 |
{ return a.spawn(a.point + b.point, a.time + b.time, a.pressure + b.pressure, a.tilt + b.tilt); }
|
|
|
b82ef4 |
public static TrackPoint operator- (TrackPoint a, TrackPoint b)
|
|
|
c66393 |
{ return a.spawn(a.point - b.point, a.time - b.time, a.pressure - b.pressure, a.tilt - b.tilt); }
|
|
|
b82ef4 |
public static TrackPoint operator* (TrackPoint a, double b)
|
|
|
c66393 |
{ return a.spawn(a.point*b, a.time*b, a.pressure*b, a.tilt*b); }
|
|
|
b82ef4 |
public static TrackPoint operator* (double b, TrackPoint a)
|
|
|
b82ef4 |
{ return a*b; }
|
|
|
b82ef4 |
public static TrackPoint operator/ (TrackPoint a, double b)
|
|
|
c66393 |
{ return a.spawn(a.point/b, a.time/b, a.pressure/b, a.tilt/b); }
|
|
|
b82ef4 |
}
|
|
|
b82ef4 |
}
|
|
|
b82ef4 |
|