Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

CursorInt.H

Go to the documentation of this file.
00001 
00010 #ifndef CURSORINT_H
00011 #define CURSORINT_H
00012 
00013 // Gluebase includes
00014 #define OUTSIDE_GLUE_CORE
00015 #include <fsa/fsa.H>
00016 #include <dev/room6d.H>
00017 #include <config/config.H>
00018 #include <std/hash.H>
00019 
00020 #include "DrawObj.H"
00021 
00022 namespace InSpace {
00023 
00024 class CursorInt : public Interactor<CursorInt>
00025 {
00026  public:
00027 
00028   CursorInt(str_ptr devName, int genEvents=1, str_ptr name="CursorInt") :
00029     Interactor<CursorInt>(name), _genEvents(genEvents), _cursorDev(name) {
00030     
00031     _tracker = new EVENTroom6d(devName);
00032     
00033     _entry += Arc(this, Gd(_tracker), &CursorInt::motion);
00034     EVENTmgr::add_handler(new FSA(&_entry));
00035     
00036   }
00037   
00038   virtual ~CursorInt() {}
00039   
00040 
00041   void addDrawObj(DrawObj *o)    { _drawobjs += o; }
00042   void removeDrawObj(DrawObj *o) { _drawobjs -= o; }
00043 
00044 
00045  protected:
00046 
00047   void motion(cEVENTroom6dptr &evt, STATE *&) {
00048     //Wtransf m = MathTranslate::instance()->ROOM_TO_WORLD() * evt->cur();
00049     Wtransf m = evt->cur();
00050 
00051     for (int i=0;i<_drawobjs.num();i++) {
00052       _drawobjs[i]->setXform(m);
00053     }
00054 
00055     if (_genEvents)
00056       _cursorDev.event(evt->cur(),0.0);
00057   }
00058 
00059   
00060   ARRAY<DrawObj*>  _drawobjs;
00061   
00062   EVENTroom6dptr   _tracker;
00063   DEVice_room6d    _cursorDev;
00064   int              _genEvents;
00065 };
00066 
00067 }
00068 #endif

Generated on Thu Jul 8 15:19:28 2004 for inspace by doxygen 1.3.4