-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmotion.h
49 lines (41 loc) · 792 Bytes
/
motion.h
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
#ifndef _UI_MOTION_H_
#define _UI_MOTION_H_
#include "plugins/components/utils/inRect.h"
#include "plugins/components/motionInterface.h"
// Touch and mouse motion
class Motion: public MotionInterface
{
public:
void setId(int id)
{
this->id = id;
}
void init(int id, int x, int y)
{
this->id = id;
position.x = x;
position.y = y;
origin.x = x;
origin.y = y;
counter = 0;
}
void move(int x, int y)
{
position.x = x;
position.y = y;
counter++;
}
bool isStarting()
{
return counter == 0;
}
bool in(Rect rect)
{
return inRect(rect, position);
}
bool originIn(Rect rect)
{
return inRect(rect, origin);
}
};
#endif