00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _CIvfFlyHandler_h_
00026 #define _CIvfFlyHandler_h_
00027
00028 #include <ivf/IvfBase.h>
00029 #include <ivf/IvfCamera.h>
00030
00031 #include <ivfwidget/IvfWidgetBase.h>
00032 #include <ivfwidget/IvfHandlerBase.h>
00033
00034 IvfSmartPointer(CIvfFlyHandler);
00035
00053 class IVFWIDGET_API CIvfFlyHandler : public CIvfHandlerBase,
00054 CIvfKeyboardEvent,
00055 CIvfMouseUpEvent,
00056 CIvfMouseMoveEvent,
00057 CIvfMouseDownEvent
00058 {
00059 private:
00060 void doRedraw();
00061 int m_mouseDownPos[2];
00062 int m_mouseDelta[2];
00063 double m_mouseSensitivity;
00064 double m_speed;
00065 double m_maxSpeed;
00066 double m_speedStep;
00067 double m_t;
00068 double m_dt;
00069 double m_verticalSpeed;
00070 double m_horisontalSpeed;
00071
00072 bool m_firstFrame;
00073 bool m_doRedraw;
00074
00075 CIvfCameraPtr m_camera;
00076 CIvfWidgetBase* m_widget;
00077 public:
00085 CIvfFlyHandler(CIvfWidgetBase* widget, CIvfCamera* camera);
00086 virtual ~CIvfFlyHandler();
00087
00088 IvfClassInfo("CIvfFlyHandler",CIvfHandlerBase);
00089
00098 void update();
00099
00108 void setMouseSensitivity(double value);
00109
00111 double getMouseSensitivity();
00112
00120 void setSpeedStep(double step);
00121
00123 double getSpeedStep();
00124
00126 void setMaxSpeed(double speed);
00127
00129 double getMaxSpeed();
00130
00137 void setRedraw(bool flag);
00138
00139 virtual void onKeyboard(int key, int x, int y);
00140 virtual void onMouseUp(int x, int y);
00141 virtual void onMouseDown(int x, int y);
00142 virtual void onMouseMove(int x, int y);
00143
00144 void doKeyboard(int key, int x, int y);
00145 void doMouseUp(int x, int y);
00146 void doMouseMove(int x, int y);
00147 void doMouseDown(int x, int y);
00148 protected:
00149 virtual void doDeactivate();
00150 virtual void doActivate();
00151 };
00160 #endif
00161