summaryrefslogtreecommitdiff
path: root/kurator/src/Mouse.cpp
blob: e66d86957e4666b6a328233759327e83b88d9701 (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
#include "Mouse.h"

#include <raylib.h>

#include <kurator/engine/Point.h>


namespace kurator
{


Mouse::Mouse() :
	start_ {position()}
{
}


void
Mouse::update()
{
	if (!IsMouseButtonDown(MOUSE_BUTTON_LEFT))
		start_ = position();
}


engine::Point
Mouse::position() const
{
	return {static_cast<double>(GetMouseX()), static_cast<double>(GetMouseY())};
}


engine::Point
Mouse::start() const
{
	return start_;
}


bool
Mouse::is_dragging() const
{
	return start_ != position();
}


}  // namespace kurator