00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef FF3DDEVICESENDERAGENT_H
00024 #define FF3DDEVICESENDERAGENT_H
00025 #include "micolelib.h"
00026
00027 #define BUTTON_LAG 0.1
00029 #include <config.h>
00030 #include "MicoleAgentThread.h"
00031
00032 #include <Display.h>
00033 #include <Scene.h>
00034 #include <Node.h>
00035 #include <Field.h>
00036
00037 #include <iostream>
00038
00039
00040 using namespace Reachin;
00041 using namespace std;
00042
00070 class MICOLELIB_API FF3DDeviceSenderAgent : public Node, MicoleAgentThread
00071 {
00072 public:
00076 struct FF3DCoord : public Dependent<EvaldFField< FF3DCoord, SFVec3f, SFVec3f >>
00077 {
00078 void evaluate( SFVec3f * constraint_position )
00079 {
00080 if (constraint_position)
00081 {
00082 Vec3f p = constraint_position->get();
00083 value.x = p.x;
00084 value.y = p.y;
00085 value.z = p.z;
00086 }
00087
00088 }
00089 };
00090
00094 struct ButtonPress : public Dependent< EvaldFField< ButtonPress, SFBool, SFBool > >
00095 {
00096 ButtonPress() : pressed(false), skip(false), last_event(0) { }
00097 void evaluate(SFBool);
00098 bool eventPressed();
00099 bool eventReleased();
00100 bool pressed;
00101 bool skip;
00102 Time last_event;
00103 };
00104 auto_ptr< FF3DCoord > _FF3DCoord;
00105
00106 auto_ptr< ButtonPress > _buttonPress;
00107
00113 FF3DDeviceSenderAgent(const int &pDelay = 8);
00114
00115 ~FF3DDeviceSenderAgent();
00116
00120 virtual void run();
00121
00122 protected:
00126 virtual void prepareToStop(int argc, const char **argv);
00130 virtual void prepareToSuspend(int argc, const char **argv);
00131
00132 private:
00133 int _delay;
00134 };
00135
00138
00139 #endif