Planeshift
pawstexturemanager.h
Go to the documentation of this file.
1 /*
2  * pawstexturemanager.h - Author: Andrew Craig
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 // pawstexturemanager.h: interface for the pawsTextureManager class.
20 //
22 
23 #ifndef PAWS_TEXTURE_MANAGER
24 #define PAWS_TEXTURE_MANAGER
25 
26 #include <csutil/ref.h>
27 #include <csutil/csstring.h>
28 #include <csutil/objreg.h>
29 #include <csutil/parray.h>
30 #include <cstool/cspixmap.h>
31 #include <igraphic/image.h>
32 #include <csgeom/csrectrg.h>
33 
34 #include <ivideo/texture.h>
35 #include <iutil/vfs.h>
36 #include <iutil/document.h>
37 
38 class pawsTextureManager;
39 
44 struct iPawsImage : public virtual iBase
45 {
46  SCF_INTERFACE(iPawsImage, 1, 0, 0);
47  virtual const char* GetName() const = 0;
48 
49  virtual void Draw(int x, int y, int alpha=-1) = 0;
50  virtual void Draw(csRect rect, int alpha=-1) = 0;
51  virtual void Draw(int x, int y, int newWidth, int newHeight, int alpha=-1) = 0;
52 
53  virtual int GetWidth() const = 0;
54  virtual int GetHeight() const = 0;
55  virtual void ExpandClipRect(csRect &clipRect) = 0;
56 
57  virtual int GetDefaultAlpha() const = 0;
58  virtual bool IsLoaded() const = 0;
59 };
60 
62 {
63 public:
64  pawsTextureManager(iObjectRegistry* objectReg);
65  virtual ~pawsTextureManager();
66 
81  bool LoadImageList(const char* listName);
82 
91  void Remove(const char* name);
92 
93  csPtr<iPawsImage> GetPawsImage(const char* name);
94  csPtr<iPawsImage> GetOrAddPawsImage(const char* name);
95  bool AddImage(const char* resource);
96  void AddPawsImage(csRef<iPawsImage> &element);
97 
98 public:
99  iObjectRegistry* objectReg;
100 
101  csRef<iVFS> vfs;
102  csRef<iDocumentSystem> xml;
103 
104  csHash<csRef<iPawsImage>, csString> elementList;
105 };
106 
109 #endif
110 
111 
virtual void ExpandClipRect(csRect &clipRect)=0
virtual const char * GetName() const =0
virtual int GetDefaultAlpha() const =0
virtual bool IsLoaded() const =0
csRef< iDocumentSystem > xml
virtual int GetWidth() const =0
csHash< csRef< iPawsImage >, csString > elementList
virtual void Draw(int x, int y, int alpha=-1)=0
virtual int GetHeight() const =0
iObjectRegistry * objectReg
SCF_INTERFACE(iPawsImage, 1, 0, 0)