tfc 0.7.0

The Fat Controller. A library for simulating mouse and keyboard events.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const THRESHOLD: i32 = 120;

#[derive(Default)]
pub struct ScrollAccum {
    x: i32,
    y: i32,
}

impl ScrollAccum {
    pub fn accumulate(&mut self, x: i32, y: i32) -> (i32, i32) {
        self.x += x;
        self.y += y;
        let result = (self.x / THRESHOLD, self.y / THRESHOLD);
        self.x %= THRESHOLD;
        self.y %= THRESHOLD;
        result
    }
}