Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

ViewerPoint.h

Go to the documentation of this file.
00001 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00002 #ifndef OglGui_ViewerPoint_h
00003 #define OglGui_ViewerPoint_h
00004 
00005 #ifndef OglGui_View_h
00006 #include "OglGui/View.h"
00007 #endif
00008 
00009 namespace OglGui {
00010 
00011 class ViewerPoint : public OglGui::View
00012 {
00013 public:
00014     static const int    cMagicNr = -32112321;
00015 
00016     ViewerPoint(OGLWND* oglWnd, OGLIMAGE* im, float x, float y,
00017                 ViewListener* li=0) :
00018         OglGui::View(oglWnd, im, 0, 0, 6, 6, li)
00019     {
00020         Init(x,y,0);
00021     }
00022 
00023     ViewerPoint(OGLVIEW* oglView, float x, float y) :
00024         OglGui::View(oglView)
00025     {
00026         Init(x,y,0);
00027     }
00028 
00029     long long   GetId()                 { return mId; }
00030     void        SetId(long long id)     { mId = id; }
00031 
00032     virtual void OnDrawView()
00033     {
00034         OglGui::View::OnDrawView();
00035         if (GetSelected())
00036         {
00037             glPushMatrix();
00038             viewSys.View2DTransform(mView2D);
00039             ULONG   col = mView2D->borderCol;
00040             SetSolidLineColor(col);
00041             DrawRectangle(-2, -2, mView2D->w+4, mView2D->h+4);
00042             glPopMatrix();
00043         }
00044     }
00045 
00046     virtual void AnimatePoint()
00047     {
00048         if ((mX+=mDeltaX) > 200 || mX < -200)
00049             mDeltaX = -mDeltaX;
00050         if ((mY+=mDeltaY) > 200 || mY < -200)
00051             mDeltaY = -mDeltaY;
00052         mView2D->rotZ += 2;
00053     }
00054 
00055     float PointX()          { return mX; }
00056     void  PointX(float x)   { mX = x; }
00057     float PointY()          { return mY; }
00058     void  PointY(float y)   { mY = y; }
00059 
00060     void PointXY(float x, float y)
00061     {
00062         mX = x;
00063         mY = y;
00064     }
00065 
00066 protected:
00067     float       mX;
00068     float       mY;
00069     long long   mId;
00070 
00071 private:
00072     float   mDeltaX;
00073     float   mDeltaY;
00074 
00075     void Init(float x, float y, long long id)
00076     {
00077         mX = x;
00078         mY = y;
00079         mId = id;
00080         viewSys.SetSysData(mView2D, 2, (void*) cMagicNr);
00081         mDeltaX = (1.f / (3+(rand()%50))) * (rand()%2?-1:1);
00082         mDeltaY = (1.f / (3+(rand()%50))) * (rand()%2?-1:1);;
00083         if (mDeltaX > mDeltaY-0.001 && mDeltaX < mDeltaY+0.001)
00084             mDeltaX += 0.002;
00085     }
00086 };
00087 
00088 } // namespace OglGui
00089 #endif
00090 

Generated on Fri Mar 19 09:31:40 2010 for ImpalaSrc by  doxygen 1.5.1