39 _type(type), _x(0.0f), _y(0.0f), _z(0.0f) {
68 if ((x <
_x) || (y <
_y))
119 glTranslatef(roundf(
_x), roundf(
_y),
_z);
122 for (std::vector<Quad>::const_iterator q =
_quads.begin(); q !=
_quads.end(); ++q) {
123 for (
int i = 0; i < 4; i++) {
124 glTexCoord2f(q->tX[i], q->tY[i]);
125 glVertex2f (q->vX[i], q->vY[i]);
133 int n = ceilf(
_length / 16.0f);
143 _quads[0].tX[1] = 3.0f / 16.0f;
_quads[0].tY[1] = 2.0f / 16.0f;
144 _quads[0].tX[2] = 13.0f / 16.0f;
_quads[0].tY[2] = 2.0f / 16.0f;
145 _quads[0].tX[3] = 13.0f / 16.0f;
_quads[0].tY[3] = 0.0f;
149 _quads[0].vX[2] = x + 2.0f;
_quads[0].vY[2] = y + 10.0f;
157 for (
int i = 0; i < n; i++) {
158 float pLength =
MIN(length, 16.0f);
159 float tLength = pLength / 16.0f;
161 _quads[i + 1].tX[0] = 0.0f;
_quads[i + 1].tY[0] = 3.0f / 16.0f;
162 _quads[i + 1].tX[1] = tLength;
_quads[i + 1].tY[1] = 3.0f / 16.0f;
163 _quads[i + 1].tX[2] = tLength;
_quads[i + 1].tY[2] = 13.0f / 16.0f;
164 _quads[i + 1].tX[3] = 0.0f;
_quads[i + 1].tY[3] = 13.0f / 16.0f;
167 _quads[i + 1].vX[1] = x + pLength;
_quads[i + 1].vY[1] = y;
168 _quads[i + 1].vX[2] = x + pLength;
_quads[i + 1].vY[2] = y + 10.0f;
169 _quads[i + 1].vX[3] = x ;
_quads[i + 1].vY[3] = y + 10.0f;
176 _quads[n + 1].tX[0] = 3.0f / 16.0f;
_quads[n + 1].tY[0] = 14.0f / 16.0f;
177 _quads[n + 1].tX[1] = 3.0f / 16.0f;
_quads[n + 1].tY[1] = 16.0f / 16.0f;
178 _quads[n + 1].tX[2] = 13.0f / 16.0f;
_quads[n + 1].tY[2] = 16.0f / 16.0f;
179 _quads[n + 1].tX[3] = 13.0f / 16.0f;
_quads[n + 1].tY[3] = 14.0f / 16.0f;
182 _quads[n + 1].vX[1] = x + 2.0f;
_quads[n + 1].vY[1] = y;
183 _quads[n + 1].vX[2] = x + 2.0f;
_quads[n + 1].vY[2] = y + 10.0f;
184 _quads[n + 1].vX[3] = x ;
_quads[n + 1].vY[3] = y + 10.0f;
189 int n = ceilf(
_length / 16.0f);
199 _quads[0].tX[1] = 3.0f / 16.0f;
_quads[0].tY[1] = 2.0f / 16.0f;
200 _quads[0].tX[2] = 13.0f / 16.0f;
_quads[0].tY[2] = 2.0f / 16.0f;
201 _quads[0].tX[3] = 13.0f / 16.0f;
_quads[0].tY[3] = 0.0f;
205 _quads[0].vX[2] = x + 10.0f;
_quads[0].vY[2] = y + 2.0f;
213 for (
int i = 0; i < n; i++) {
214 float pLength =
MIN(length, 16.0f);
215 float tLength = pLength / 16.0f;
217 _quads[i + 1].tX[0] = 0.0f;
_quads[i + 1].tY[0] = 3.0f / 16.0f;
218 _quads[i + 1].tX[1] = 0.0f;
_quads[i + 1].tY[1] = 13.0f / 16.0f;
219 _quads[i + 1].tX[2] = tLength;
_quads[i + 1].tY[2] = 13.0f / 16.0f;
220 _quads[i + 1].tX[3] = tLength;
_quads[i + 1].tY[3] = 3.0f / 16.0f;
223 _quads[i + 1].vX[1] = x + 10.0f;
_quads[i + 1].vY[1] = y;
224 _quads[i + 1].vX[2] = x + 10.0f;
_quads[i + 1].vY[2] = y + pLength;
225 _quads[i + 1].vX[3] = x ;
_quads[i + 1].vY[3] = y + pLength;
232 _quads[n + 1].tX[0] = 3.0f / 16.0f;
_quads[n + 1].tY[0] = 14.0f / 16.0f;
233 _quads[n + 1].tX[1] = 3.0f / 16.0f;
_quads[n + 1].tY[1] = 16.0f / 16.0f;
234 _quads[n + 1].tX[2] = 13.0f / 16.0f;
_quads[n + 1].tY[2] = 16.0f / 16.0f;
235 _quads[n + 1].tX[3] = 13.0f / 16.0f;
_quads[n + 1].tY[3] = 14.0f / 16.0f;
238 _quads[n + 1].vX[1] = x + 10.0f;
_quads[n + 1].vY[1] = y;
239 _quads[n + 1].vX[2] = x + 10.0f;
_quads[n + 1].vY[2] = y + 2.0f;
240 _quads[n + 1].vX[3] = x ;
_quads[n + 1].vY[3] = y + 2.0f;
246 NWNWidget(gui, tag), _type(type), _range(range), _state(0.0f), _scrollbar(type) {
282 _full = percent >= 1.0f;
286 if ((((
int)
_length) % 2) == 1)
305 float pos =
_state * span;
347 if (state != SDL_BUTTON_LMASK) {
366 if (state != SDL_BUTTON_LMASK)
virtual void show()
Show the object.
Only render transparent parts.
The global graphics manager.
virtual void hide()
Hide the object.
A class holding an UTF-8 string.
#define TextureMan
Shortcut for accessing the texture manager.
double _distance
The distance of the object from the viewer.
The Aurora texture manager.
void setClickable(bool clickable)
Set the object's clickable state.
Utility templates and functions.
void setTag(const Common::UString &tag)
Set the object's tag.
T CLIP(T v, T amin, T amax)
#define GfxMan
Shortcut for accessing the graphics manager.