tile.h

00001 /*--License:
00002         Kyra Sprite Engine
00003         Copyright Lee Thomason (Grinning Lizard Software) 2001-2005
00004         www.grinninglizard.com/kyra
00005         www.sourceforge.net/projects/kyra
00006 
00007         Kyra is provided under the LGPL. 
00008         
00009         I kindly request you display a splash screen (provided in the HTML documentation)
00010         to promote Kyra and acknowledge the software and everyone who has contributed to it, 
00011         but it is not required by the license.
00012 
00013 --- LGPL License --
00014 
00015     This library is free software; you can redistribute it and/or
00016     modify it under the terms of the GNU Lesser General Public
00017     License as published by the Free Software Foundation; either
00018     version 2.1 of the License, or (at your option) any later version.
00019 
00020     This library is distributed in the hope that it will be useful,
00021     but WITHOUT ANY WARRANTY; without even the implied warranty of
00022     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00023     Lesser General Public License for more details.
00024 
00025     You should have received a copy of the GNU Lesser General Public
00026     License along with this library; if not, write to the Free Software
00027     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 
00029         The full text of the license can be found in lgpl.txt
00030 */
00031 
00032 
00033 #ifndef KYRA_TILE_INCLUDED
00034 #define KYRA_TILE_INCLUDED
00035 
00036 #include "image.h"
00037 #include "tileresource.h"
00038 
00039 
00040 struct KrPaintInfo;
00041 class  KrTileResource;
00042 union KrRGBA;
00043 
00044 
00061 class KrTile : public KrImage
00062 {
00063   public:
00064         KrTile( KrTileResource* resource );
00065         virtual ~KrTile();
00066 
00077         enum eROTATION  {
00078                 ROTATION_NONE = 0,
00079                 ROTATION_90CW,
00080                 ROTATION_180CW,
00081                 ROTATION_270CW,
00082                 ROTATION_NONE_HFLIP,
00083                 ROTATION_90CW_HFLIP,
00084                 ROTATION_180CW_HFLIP,
00085                 ROTATION_270CW_HFLIP,
00086                 ROTATION_MAX
00087         };
00088 
00089         void SetRotation( int rotation );
00090         int  GetRotation()                                              { return rotation; }
00091 
00093         int Size() const        { return resource->Size(); }
00094 
00095 
00096         virtual void Draw(      KrPaintInfo* paintInfo, 
00097                                                 const grinliz::Rectangle2I& clip,
00098                                                 int window );
00099 
00100         virtual KrImNode* Clone();
00101 
00102         virtual bool HitTest( int x, int y, int flags, std::vector<KrImage*>* results, int window );
00103 
00104         virtual void CalcTransform( int window );
00105         virtual void QueryBoundingBox( grinliz::Rectangle2I* boundingBox, int window = 0 );
00106 
00107         virtual KrTile*  ToTile()                               { return this; }
00108         virtual KrResource* Resource()                  { return resource; }
00109         KrTileResource* TileResource()                  { return resource; }
00110         
00111   protected:
00112         KrTileResource* resource;
00113 
00114   private:
00115         int rotation;
00116 };
00117 
00118 
00119 #endif

Generated on Thu Jul 20 20:45:32 2006 for Kyra by  doxygen 1.4.7