summaryrefslogtreecommitdiffhomepage
path: root/SixenseSDK/include/sixense_utils/mouse_pointer.hpp
blob: fb16e6a05a0ee02a6f548a5dd8e734e8ee53d6dd (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 *
 * SIXENSE CONFIDENTIAL
 *
 * Copyright (C) 2011 Sixense Entertainment Inc.
 * All Rights Reserved
 *
 */

#ifndef SIXENSE_UTILS_MOUSE_POINTER_HPP
#define SIXENSE_UTILS_MOUSE_POINTER_HPP

#pragma warning(push)
#pragma warning( disable:4251 )

#include "sixense_utils/export.hpp"
#include "sixense_utils/interfaces.hpp"

using sixenseMath::Vector2;
using sixenseMath::Vector3;
using sixenseMath::Matrix3;

namespace sixenseUtils {

	class SIXENSE_UTILS_EXPORT MousePointer : public IMousePointer {

	public:
		MousePointer();
		sixenseMath::Vector2 update( sixenseControllerData *cd );

		void setSensitivity( float sensitivity );
		void setAcceleration( float acceleration );
		void setSlideEnabled( bool slide_enabled );
		void setAspectRatio( float aspect_ratio );
		void setLockRelativeToWindow(bool lock);
		void setLockRelativeToClientBounds(bool client);

		Vector2 getMouseOffset() { return mouse_offset; }
		void setMouseOffset( Vector2 offset ) { mouse_offset = offset; }
		float getRollAngle();

		void setCenter();
		void setWindowCenter();

	private:
		bool _slide_enabled;
		float _aspect_ratio;
		float _sensitivity;
		float _screen_width_in_mm;

		// velocity params
		float _min_vel, _max_vel;
		float _acceleration;
	
		// This offset is the position of the center of the virtual screen relative to the base
		Vector2 mouse_offset;

		// Keep track of the previous mouse pos so we can compute velocity
		Vector2 _last_mouse_pos;

		// Keep track of the last accel so we can filter it
		float _last_accel;

		float _roll_angle;

		bool _center_mouse_requested;
		bool _center_mouse_on_window;
		
		bool _lock_relative_to_window;
		bool _lock_relative_using_client_bounds;
	};
}

#pragma warning(pop)

#endif