Planeshift

pawsmouse.h

Go to the documentation of this file.
00001 /*
00002  * pawsmouse.h - Author: Andrew Craig
00003  *
00004  * Copyright (C) 2001 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  */
00019 // pawsmouse.h: interface for the pawsMouse class.
00020 //
00022 
00023 #ifndef PAWS_MOUSE_HEADER
00024 #define PAWS_MOUSE_HEADER
00025 
00026 #include <csgeom/vector2.h>
00027 #include "pawstexturemanager.h"
00028 #include <igraphic/imageio.h>
00029 #include <util/psutil.h>
00030 
00031 class PawsManager;
00032 
00033 struct iGraphics3D;
00034 
00041 class pawsMouse
00042 {
00043 
00044 public:
00045     pawsMouse();
00046     virtual ~pawsMouse();
00047 
00049     void SetPosition(int x, int y);
00050 
00052     void UpdateDragPosition();
00053 
00055     psPoint GetPosition()
00056     {
00057         return currentPosition;
00058     }
00059 
00061     psPoint GetDeltas()
00062     {
00063         return deltas;
00064     }
00065 
00069     void ChangeImage(const char* imageName);
00070     void ChangeImage(iPawsImage* drawable);
00071 
00072     void Draw();
00073     void Hide(bool h = true);
00074     void WantCrosshair(bool h = true)
00075     {
00076         crosshair = h;
00077     }
00078 
00079     struct ImgSize
00080     {
00081         int width;
00082         int height;
00083     };
00084 
00085     ImgSize GetImageSize()
00086     {
00087         ImgSize size;
00088         size.width = 0;
00089         size.height = 0;
00090         if(cursorImage)
00091         {
00092             size.height = cursorImage->GetHeight();
00093             size.width = cursorImage->GetWidth();
00094         }
00095         return size;
00096     }
00097 
00098 protected:
00099     csRef<iGraphics3D> graphics3D;
00100     csRef<iVFS> vfs;
00101     csRef<iImageIO>    imageLoader;
00102 
00103     psPoint currentPosition;
00104     psPoint deltas;
00105 
00106     csRef<iPawsImage> cursorImage;
00107     csRef<iPawsImage> crosshairImage;
00108     bool hidden, crosshair;
00109 
00110     bool useOS;
00111     bool basicCursor;
00112 
00113     int transparentR;
00114     int transparentG;
00115     int transparentB;
00116 
00117     csRef<iImage> image;
00118 
00119     void SetOSMouse(iPawsImage* mouseImage);
00120 };
00121 
00124 #endif
00125