-
Notifications
You must be signed in to change notification settings - Fork 0
/
VacuumReachingWidget.hpp
46 lines (35 loc) · 1.44 KB
/
VacuumReachingWidget.hpp
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
#ifndef VacuumReachingWidget_H
#define VacuumReachingWidget_H
#include <MultiWidgets/ImageWidget.hpp>
#include <Radiant/Grid.hpp>
#include <Luminous/Utils.hpp>
#include <Box2D/Box2D.h>
#include <Radiant/Mutex.hpp>
#include <map>
#include "ReachingWidget.hpp"
class VacuumReachingWidget : public ReachingWidget {
public:
VacuumReachingWidget(MultiWidgets::Widget * parent = 0);
void ensureWidgetsHaveBodies();
void applyForceToBodies(float dt);
void input(MultiWidgets::GrabManager & gm, float dt);
void render(Luminous::RenderContext & r);
void addMovingAndStaticWidgetPair(MultiWidgets::Widget* staticWidget, MultiWidgets::Widget* movingWidget);
void update(float dt);
void decayVectorField(Radiant::MemGrid32f (&field)[2], float dt);
virtual void processMessage(const char* msg, Radiant::BinaryData& bd);
void resetAndClear();
void isReachingActive(bool active);
private:
void addVacuumWidget(long fingerId, Nimble::Vector2 center, double rotation);
void deleteVacuumWidget(long fingerId);
void modifyVacuumWidget(long fingerId, double rotation, float intensity);
void applyVacuum();
std::map<long, VacuumWidget*> m_vacuumWidgets;
std::map<void*, MultiWidgets::Widget *> m_static_to_moving;
std::map<void*, MultiWidgets::Widget *> m_moving_to_static;
std::map<MultiWidgets::Widget *, MultiWidgets::Widget *> m_vacuumClones;
Radiant::Mutex cloneMapMutex;
bool m_active;
};
#endif // VacuumReachingWidget_H