9 #if !defined(__Leap_h__)
18 #if defined(_MSC_VER) && (_MSC_VER < 1600)
19 typedef __int32 int32_t;
20 typedef __int64 int64_t;
21 typedef unsigned __int32 uint32_t;
22 typedef unsigned __int64 uint64_t;
28 #if defined(_WIN32) // Windows
31 #elif LEAP_API_IMPLEMENTATION
32 #define LEAP_EXPORT __declspec(dllexport)
34 #define LEAP_EXPORT __declspec(dllimport)
36 #define LEAP_EXPORT_CLASS
37 #define LEAP_EXPORT_PLUGIN __declspec(dllexport)
39 #define LEAP_EXPORT __attribute__((visibility("default")))
40 #define LEAP_EXPORT_CLASS __attribute__((visibility("default")))
41 #define LEAP_EXPORT_PLUGIN __attribute__((visibility("default")))
44 #define LEAP_EXPORT_CLASS
45 #define LEAP_EXPORT_PLUGIN
51 class LEAP_EXPORT_CLASS Interface {
53 struct Implementation {
54 LEAP_EXPORT
virtual ~Implementation() {}
57 LEAP_EXPORT Interface(
void* owner);
58 LEAP_EXPORT Interface(Implementation* reference,
void* owner);
59 LEAP_EXPORT Interface(
const Interface& rhs);
60 Interface(
class SharedObject*
object);
61 LEAP_EXPORT Interface& operator=(
const Interface& rhs);
62 LEAP_EXPORT
virtual ~Interface();
63 template<
typename T> T*
get()
const {
return static_cast<T*
>(reference()); }
64 class SharedObject* m_object;
66 LEAP_EXPORT Implementation* reference()
const;
70 class PointableImplementation;
71 class FingerImplementation;
72 class ToolImplementation;
73 class HandImplementation;
74 class GestureImplementation;
75 class ScreenImplementation;
76 class DeviceImplementation;
77 class InteractionBoxImplementation;
78 class FrameImplementation;
79 class ControllerImplementation;
80 template<
typename T>
class ListBaseImplementation;
159 LEAP_EXPORT int32_t
id()
const;
213 LEAP_EXPORT
float width()
const;
223 LEAP_EXPORT
float length()
const;
239 LEAP_EXPORT
bool isTool()
const;
246 LEAP_EXPORT
bool isValid()
const;
333 LEAP_EXPORT std::string
toString()
const;
352 Finger(FingerImplementation*);
377 LEAP_EXPORT
static const Finger&
invalid();
384 LEAP_EXPORT std::string
toString()
const;
406 Tool(ToolImplementation*);
431 LEAP_EXPORT
static const Tool&
invalid();
438 LEAP_EXPORT std::string
toString()
const;
455 class Hand :
public Interface {
458 Hand(HandImplementation*);
480 LEAP_EXPORT int32_t
id()
const;
578 LEAP_EXPORT
Tool tool(int32_t
id)
const;
803 LEAP_EXPORT
bool isValid()
const;
814 LEAP_EXPORT
static const Hand&
invalid();
821 LEAP_EXPORT
bool operator==(
const Hand&)
const;
828 LEAP_EXPORT
bool operator!=(
const Hand&)
const;
831 LEAP_EXPORT
friend std::ostream&
operator<<(std::ostream&,
const Hand&);
838 LEAP_EXPORT std::string
toString()
const;
906 Gesture(GestureImplementation*);
970 LEAP_EXPORT int32_t
id()
const;
983 LEAP_EXPORT int64_t
duration()
const;
1030 LEAP_EXPORT
bool isValid()
const;
1052 LEAP_EXPORT std::string
toString()
const;
1147 LEAP_EXPORT
float speed()
const;
1255 LEAP_EXPORT
float progress()
const;
1262 LEAP_EXPORT
float radius()
const;
1351 LEAP_EXPORT
float progress()
const;
1442 LEAP_EXPORT
float progress()
const;
1479 Screen(ScreenImplementation*);
1496 LEAP_EXPORT int32_t
id()
const;
1678 LEAP_EXPORT
Vector project(
const Vector& position,
bool normalize,
float clampRatio = 1.0f)
const;
1771 LEAP_EXPORT
bool isValid()
const;
1782 LEAP_EXPORT
static const Screen&
invalid();
1789 LEAP_EXPORT
bool operator==(
const Screen&)
const;
1796 LEAP_EXPORT
bool operator!=(
const Screen&)
const;
1799 LEAP_EXPORT
friend std::ostream&
operator<<(std::ostream&,
const Screen&);
1806 LEAP_EXPORT std::string
toString()
const;
1822 Device(DeviceImplementation*);
1869 LEAP_EXPORT
float range()
const;
1890 LEAP_EXPORT
bool isValid()
const;
1901 LEAP_EXPORT
static const Device&
invalid();
1909 LEAP_EXPORT
bool operator==(
const Device&)
const;
1917 LEAP_EXPORT
bool operator!=(
const Device&)
const;
1920 LEAP_EXPORT
friend std::ostream&
operator<<(std::ostream&,
const Device&);
1927 LEAP_EXPORT std::string
toString()
const;
1931 template<
typename L,
typename T>
1932 class ConstListIterator {
1934 ConstListIterator<L,T>(
const L& list,
int index) : m_list(list), m_index(index) {}
1936 const T operator*()
const {
return m_list[m_index]; }
1937 const ConstListIterator<L,T>& operator++() { ++m_index;
return *
this; }
1938 bool operator!=(
const ConstListIterator<L,T>& rhs)
const {
return m_index != rhs.m_index; }
1940 typedef std::ptrdiff_t difference_type;
1941 typedef T value_type;
1942 typedef const T* pointer;
1943 typedef const T& reference;
1944 typedef std::forward_iterator_tag iterator_category;
1970 LEAP_EXPORT
int count()
const;
1976 LEAP_EXPORT
bool isEmpty()
const;
1982 LEAP_EXPORT
bool empty()
const;
1996 LEAP_EXPORT PointableList&
append(
const PointableList& other);
2055 FingerList(
const ListBaseImplementation<Finger>&);
2064 LEAP_EXPORT
int count()
const;
2070 LEAP_EXPORT
bool isEmpty()
const;
2076 LEAP_EXPORT
bool empty()
const;
2090 LEAP_EXPORT FingerList&
append(
const FingerList& other);
2134 ToolList(
const ListBaseImplementation<Tool>&);
2143 LEAP_EXPORT
int count()
const;
2149 LEAP_EXPORT
bool isEmpty()
const;
2155 LEAP_EXPORT
bool empty()
const;
2169 LEAP_EXPORT ToolList&
append(
const ToolList& other);
2213 HandList(
const ListBaseImplementation<Hand>&);
2222 LEAP_EXPORT
int count()
const;
2228 LEAP_EXPORT
bool isEmpty()
const;
2234 LEAP_EXPORT
bool empty()
const;
2248 LEAP_EXPORT HandList&
append(
const HandList& other);
2292 GestureList(
const ListBaseImplementation<Gesture>&);
2301 LEAP_EXPORT
int count()
const;
2307 LEAP_EXPORT
bool isEmpty()
const;
2313 LEAP_EXPORT
bool empty()
const;
2327 LEAP_EXPORT GestureList&
append(
const GestureList& other);
2356 ScreenList(
const ListBaseImplementation<Screen>&);
2365 LEAP_EXPORT
int count()
const;
2371 LEAP_EXPORT
bool isEmpty()
const;
2377 LEAP_EXPORT
bool empty()
const;
2472 DeviceList(
const ListBaseImplementation<Device>&);
2481 LEAP_EXPORT
int count()
const;
2487 LEAP_EXPORT
bool isEmpty()
const;
2501 LEAP_EXPORT DeviceList&
append(
const DeviceList& other);
2572 LEAP_EXPORT
float width()
const;
2579 LEAP_EXPORT
float height()
const;
2586 LEAP_EXPORT
float depth()
const;
2593 LEAP_EXPORT
bool isValid()
const;
2604 LEAP_EXPORT
static const InteractionBox&
invalid();
2611 LEAP_EXPORT
bool operator==(
const InteractionBox&)
const;
2618 LEAP_EXPORT
bool operator!=(
const InteractionBox&)
const;
2621 LEAP_EXPORT
friend std::ostream&
operator<<(std::ostream&,
const InteractionBox&);
2628 LEAP_EXPORT std::string
toString()
const;
2644 Frame(FrameImplementation*);
2652 LEAP_EXPORT
Frame();
2660 LEAP_EXPORT int64_t
id()
const;
2694 LEAP_EXPORT
Hand hand(int32_t
id)
const;
2775 LEAP_EXPORT
Tool tool(int32_t
id)
const;
2887 LEAP_EXPORT
float rotationAngle(
const Frame& sinceFrame)
const;
2962 LEAP_EXPORT
float scaleFactor(
const Frame& sinceFrame)
const;
3004 LEAP_EXPORT
bool isValid()
const;
3015 LEAP_EXPORT
static const Frame&
invalid();
3022 LEAP_EXPORT
bool operator==(
const Frame&)
const;
3029 LEAP_EXPORT
bool operator!=(
const Frame&)
const;
3032 LEAP_EXPORT
friend std::ostream&
operator<<(std::ostream&,
const Frame&);
3039 LEAP_EXPORT std::string
toString()
const;
3099 LEAP_EXPORT
bool getBool(
const std::string& key)
const;
3104 LEAP_EXPORT
bool setBool(
const std::string& key,
bool value);
3107 LEAP_EXPORT int32_t
getInt32(
const std::string& key)
const;
3112 LEAP_EXPORT
bool setInt32(
const std::string& key, int32_t value);
3115 LEAP_EXPORT
float getFloat(
const std::string& key)
const;
3120 LEAP_EXPORT
bool setFloat(
const std::string& key,
float value);
3123 LEAP_EXPORT std::string
getString(
const std::string& key)
const;
3128 LEAP_EXPORT
bool setString(
const std::string& key,
const std::string& value);
3140 LEAP_EXPORT
bool save();
3198 LEAP_EXPORT
virtual ~Controller();
3341 LEAP_EXPORT
Frame frame(
int history = 0)
const;
3454 LEAP_EXPORT
virtual void onInit(
const Controller&) {}
3490 LEAP_EXPORT
virtual void onExit(
const Controller&) {}
3508 LEAP_EXPORT
virtual void onFrame(
const Controller&) {}
3539 #endif // __Leap_h__