proj home

Files   Classes   Functions   Hierarchy  

zprmouse.h

Go to the documentation of this file.
00001 #ifndef ZPRMOUSE_H
00002 #define ZPRMOUSE_H
00003 
00004 #include <point.h>
00005 #include <zpr.h>
00006 
00019 class zprmouse
00020 {
00021 public:
00022   
00024   zpr& zz;
00025 
00027   zprmouse(zpr& zz_)
00028     : zz(zz_) {}
00029 
00031   point2<uint> const mouse() const
00032     { return point2<uint>(zz.mouseX,zz.mouseY); }
00034   point2<int> const mouseint() const
00035     { return point2<int>(zz.mouseX,zz.mouseY); }
00036 
00037   template<typename T>
00038   void mouse(T & p) const
00039     { p.x = zz.mouseX; p.y = zz.mouseY; }
00040 
00042   point2<double> const mouseratio(point2<uint> const & p) const;
00044   point2<double> const mouseratio() const;
00045 
00046   point2<uint> const mouseratioInv(point2<double> const & p) const
00047   {
00048     assert(p.x<=1.0);
00049     assert(p.y<=1.0);
00050     assert(p.x>=0.0);
00051     assert(p.y>=0.0);
00052     return point2<uint>(p.x*zz.width,p.y*zz.height);
00053   }
00054 
00055   point3<double> const world(point2<uint> const & p) const;
00056 
00058   point3<double> const world(point2<double> const & p) const;
00059 
00061   point3<double> const world() const;
00062 
00063   void update()
00064     { zz.update(); }
00065 
00066 };
00067 
00068 
00069 #endif
00070 

Generated on Fri Mar 4 00:49:32 2011 for Chelton Evans Source by  doxygen 1.5.8