Cursor.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /* GG is a GUI for SDL and OpenGL.
00003    Copyright (C) 2007 T. Zachary Laine
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public License
00007    as published by the Free Software Foundation; either version 2.1
00008    of the License, or (at your option) any later version.
00009    
00010    This library 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 GNU
00013    Lesser General Public License for more details.
00014     
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA
00019 
00020    If you do not wish to comply with the terms of the LGPL please
00021    contact the author as other terms are available for a fee.
00022     
00023    Zach Laine
00024    whatwasthataddress@hotmail.com */
00025    
00029 #ifndef _GG_Cursor_h_
00030 #define _GG_Cursor_h_
00031 
00032 #include <GG/PtRect.h>
00033 
00034 #include <boost/shared_ptr.hpp>
00035 
00036 
00037 namespace GG {
00038 
00039 class Texture;
00040 
00043 class GG_API Cursor
00044 {
00045 public: 
00047     Cursor();          
00048     virtual ~Cursor(); 
00049 
00050  
00052 
00054     virtual void Render(const Pt& pt) = 0;
00056 
00057 private:
00058     friend class boost::serialization::access;
00059     template <class Archive>
00060     void serialize(Archive& ar, const unsigned int version);
00061 };
00062 
00065 class GG_API TextureCursor :
00066     public Cursor
00067 {
00068 public: 
00070 
00072     TextureCursor(const boost::shared_ptr<Texture>& texture, const Pt& hotspot = Pt());
00074  
00076     virtual void Render(const Pt& pt);
00078 
00079 private:
00080     boost::shared_ptr<Texture> m_texture;
00081     Pt                         m_hotspot;
00082 
00083     friend class boost::serialization::access;
00084     template <class Archive>
00085     void serialize(Archive& ar, const unsigned int version);
00086 };
00087 
00088 } // namespace GG
00089 
00090 // template implementations
00091 template <class Archive>
00092 void GG::Cursor::serialize(Archive& ar, const unsigned int version)
00093 {}
00094 
00095 template <class Archive>
00096 void GG::TextureCursor::serialize(Archive& ar, const unsigned int version)
00097 {
00098     ar  & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Cursor)
00099         & m_texture
00100         & m_hotspot;
00101 }
00102 
00103 #endif // _GG_Cursor_h_

Generated on Wed Mar 26 14:35:41 2008 for GG by  doxygen 1.5.2