1 /************************************************************************
2 This file is part of NE.
4 NE 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 3 of the License, or
7 (at your option) any later version.
9 NE 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 NE. If not, see <http://www.gnu.org/licenses/>.
16 ************************************************************************/
21 #include "resource/texturefactory.h"
29 Element(const std::string
&name
)
30 : m_name(name
), m_callback(0), m_r(1.0), m_g(1.0), m_b(1.0) {}
33 virtual void draw() = 0;
38 return m_callback(m_callback_data
);
43 inline void setCallback(int (*cb
)(void*), void *data
=0)
45 m_callback_data
= data
;
49 virtual void addChild(Element
*e
)
51 m_children
.push_back(e
);
54 inline unsigned int numChildren() const
56 return m_children
.size();
59 inline Element
*child(unsigned int index
)
61 return m_children
[index
];
64 inline void setPos(Vec3f p
)
69 inline const Vec3f
&getPos() const
74 inline void setSize(Vec3f s
)
79 inline const Vec3f
&getSize() const
84 inline const std::string
&getName() const
89 inline void setColor(float r
, float g
, float b
)
97 void drawBackround() {}
101 void *m_callback_data
;
102 int (*m_callback
)(void*);
109 std::vector
<Element
*> m_children
;