2 // Copyright (C) 2008 by Martin Moracek
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // 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
29 #include <boost/smart_ptr.hpp>
34 # include <unordered_map>
35 #else /* PLATFORM_MSVC */
36 # include <tr1/unordered_map>
37 #endif /* PLATFORM_MSVC */
41 #include "renderer/buffers.h"
42 #include "renderer/effect.h"
44 #include "math/vector.h"
58 void Rescale(const Vector2f
& scale
, Float2Vector
& verts
);
60 void LoadFromXml(TiXmlElement
& root
, const Vector2f
& scale
,
61 Float2Vector
& verts
, Float2Vector
& coords
);
70 typedef boost::shared_ptr
<CursorSet
> CursorSetPtr
;
71 typedef boost::weak_ptr
<CursorSet
> CursorSetRef
;
73 class CursorSetFactory
{
75 const CursorSetPtr
CreateInstance(const std::string
& filename
,
76 const Vector2f
& scale
);
77 const CursorSetPtr
CreateInstance(TiXmlElement
& root
,
78 const Vector2f
& scale
);
81 typedef std::tr1::unordered_map
<std::string
, CursorSetRef
> CursorMap
;
89 static CursorSetFactory
& Factory(void)
91 static CursorSetFactory fac
;
96 typedef cpair
<std::string
, Cursor
> CursorPair
;
97 typedef std::vector
<CursorPair
> CursorVector
;
100 const Cursor
* GetCursor(const std::string
& name
) const;
102 void OnGuiResize(const Vector2f
& scale
);
104 void LoadFromXml(TiXmlElement
& root
, const Vector2f
& scale
);
107 CursorVector cursors_
;
109 AttribBufPtr attribs_
;