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@gmail.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 
00046 class GG_API Cursor
00047 {
00048 public: 
00050     Cursor();          
00051     virtual ~Cursor(); 
00052 
00053  
00055 
00057     virtual void Render(const Pt& pt) = 0;
00059 
00060 private:
00061     friend class boost::serialization::access;
00062     template <class Archive>
00063     void serialize(Archive& ar, const unsigned int version);
00064 };
00065 
00071 class GG_API TextureCursor :
00072     public Cursor
00073 {
00074 public: 
00076 
00079     TextureCursor(const boost::shared_ptr<Texture>& texture, const Pt& hotspot = Pt());
00081  
00083     virtual void Render(const Pt& pt);
00085 
00086 private:
00087     boost::shared_ptr<Texture> m_texture;
00088     Pt                         m_hotspot;
00089 
00090     friend class boost::serialization::access;
00091     template <class Archive>
00092     void serialize(Archive& ar, const unsigned int version);
00093 };
00094 
00095 } // namespace GG
00096 
00097 // template implementations
00098 template <class Archive>
00099 void GG::Cursor::serialize(Archive& ar, const unsigned int version)
00100 {}
00101 
00102 template <class Archive>
00103 void GG::TextureCursor::serialize(Archive& ar, const unsigned int version)
00104 {
00105     ar  & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Cursor)
00106         & m_texture
00107         & m_hotspot;
00108 }
00109 
00110 #endif // _GG_Cursor_h_

Generated on Sat Mar 26 07:08:37 2011 for GG by  doxygen 1.5.9