1/**
2 * Copyright (c) 2006-2023 LOVE Development Team
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 *
8 * Permission is granted to anyone to use this software for any purpose,
9 * including commercial applications, and to alter it and redistribute it
10 * freely, subject to the following restrictions:
11 *
12 * 1. The origin of this software must not be misrepresented; you must not
13 * claim that you wrote the original software. If you use this software
14 * in a product, an acknowledgment in the product documentation would be
15 * appreciated but is not required.
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 * 3. This notice may not be removed or altered from any source distribution.
19 **/
20
21#ifndef LOVE_TOUCH_TOUCH_H
22#define LOVE_TOUCH_TOUCH_H
23
24// LOVE
25#include "common/int.h"
26#include "common/Object.h"
27#include "common/Module.h"
28
29// C++
30#include <vector>
31#include <limits>
32
33namespace love
34{
35namespace touch
36{
37
38class Touch : public Module
39{
40public:
41
42 struct TouchInfo
43 {
44 int64 id; // Identifier. Only unique for the duration of the touch-press.
45 double x; // Position in pixels along the x-axis.
46 double y; // Position in pixels along the y-axis.
47 double dx; // Amount in pixels moved along the x-axis.
48 double dy; // Amount in pixels moved along the y-axis.
49 double pressure;
50 };
51
52 virtual ~Touch() {}
53
54 // Implements Module.
55 virtual ModuleType getModuleType() const { return M_TOUCH; }
56
57 /**
58 * Gets all currently active touches.
59 **/
60 virtual const std::vector<TouchInfo> &getTouches() const = 0;
61
62 /**
63 * Gets a specific touch, using its ID.
64 **/
65 virtual const TouchInfo &getTouch(int64 id) const = 0;
66
67}; // Touch
68
69} // touch
70} // love
71
72#endif // LOVE_TOUCH_TOUCH_H
73