summaryrefslogtreecommitdiff
path: root/src/devices/ITouch.hpp
blob: 148030117edc09ed93faf4fbb500c96d7c977c8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once

#include "IHID.hpp"
#include "../macros.hpp"
#include "../helpers/math/Math.hpp"

AQUAMARINE_FORWARD(ITouch);

class ITouch : public IHID {
  public:
    virtual uint32_t               getCapabilities();
    virtual eHIDType               getType();
    virtual bool                   isVirtual() = 0;
    virtual SP<Aquamarine::ITouch> aq()        = 0;

    struct SDownEvent {
        uint32_t   timeMs  = 0;
        int32_t    touchID = 0;
        Vector2D   pos;
        SP<ITouch> device;
    };

    struct SUpEvent {
        uint32_t timeMs  = 0;
        int32_t  touchID = 0;
    };

    struct SMotionEvent {
        uint32_t timeMs  = 0;
        int32_t  touchID = 0;
        Vector2D pos;
    };

    struct SCancelEvent {
        uint32_t timeMs  = 0;
        int32_t  touchID = 0;
    };

    struct {
        CSignalT<SDownEvent>   down;
        CSignalT<SUpEvent>     up;
        CSignalT<SMotionEvent> motion;
        CSignalT<SCancelEvent> cancel;
        CSignalT<>             frame;
    } m_touchEvents;

    std::string m_boundOutput = "";

    WP<ITouch>  m_self;
};