text_y = _y + ((cur_value - vmin) * factor() /*+.5f*/);
if (option_right()) {
- glBegin(GL_LINE_STRIP);
- glVertex2f(_x, text_y + 5);
- glVertex2f(marker_xe, text_y);
- glVertex2f(_x, text_y - 5);
- glEnd();
+ _hud->_line_list.add(LineSegment(_x, text_y + 5, marker_xe, text_y));
+ _hud->_line_list.add(LineSegment(marker_xe, text_y, _x, text_y - 5));
}
if (option_left()) {
- glBegin(GL_LINE_STRIP);
- glVertex2f(right, text_y + 5);
- glVertex2f(marker_xs, text_y);
- glVertex2f(right, text_y - 5);
- glEnd();
+ _hud->_line_list.add(LineSegment(right, text_y + 5, marker_xs, text_y));
+ _hud->_line_list.add(LineSegment(marker_xs, text_y, right, text_y - 5));
}
// End if VERTICAL SCALE TYPE
marker_ye = _y + _h / 2.0; // Tick point adjust
// Bottom arrow
- glBegin(GL_LINE_STRIP);
- glVertex2f(marker_xs - bottom_4, _y);
- glVertex2f(marker_xs, marker_ye);
- glVertex2f(marker_xs + bottom_4, _y);
- glEnd();
+ _hud->_line_list.add(LineSegment(marker_xs - bottom_4, _y, marker_xs, marker_ye));
+ _hud->_line_list.add(LineSegment(marker_xs, marker_ye, marker_xs + bottom_4, _y));
}
if (option_bottom()) {
marker_ys = top - _h / 2.0;
// Top arrow
- glBegin(GL_LINE_STRIP);
- glVertex2f(marker_xs + bottom_4, top);
- glVertex2f(marker_xs, marker_ys );
- glVertex2f(marker_xs - bottom_4, top);
- glEnd();
+ _hud->_line_list.add(LineSegment(marker_xs + bottom_4, top, marker_xs, marker_ys));
+ _hud->_line_list.add(LineSegment(marker_xs, marker_ys, marker_xs - bottom_4, top));
}
void HUD::Item::draw_circle(float xoffs, float yoffs, float r) const
{
- glBegin(GL_LINE_LOOP);
float step = SG_PI / r;
- for (float alpha = 0; alpha < SG_PI * 2.0; alpha += step) {
+ double prevX = r;
+ double prevY = 0.0;
+ for (float alpha = step; alpha < SG_PI * 2.0; alpha += step) {
float x = r * cos(alpha);
float y = r * sin(alpha);
- glVertex2f(x + xoffs, y + yoffs);
+ _hud->_line_list.add(LineSegment(prevX + xoffs, prevY + yoffs,
+ x + xoffs, y + yoffs));
+ prevX = x;
+ prevY = y;
}
- glEnd();
}
void HUD::Item::draw_arc(float xoffs, float yoffs, float t0, float t1, float r) const
{
- glBegin(GL_LINE_STRIP);
float step = SG_PI / r;
t0 = t0 * SG_DEGREES_TO_RADIANS;
t1 = t1 * SG_DEGREES_TO_RADIANS;
- for (float alpha = t0; alpha < t1; alpha += step) {
+ double prevX = r * cos(t0);
+ double prevY = r * sin(t0);
+ for (float alpha = t0 + step; alpha < t1; alpha += step) {
float x = r * cos(alpha);
float y = r * sin(alpha);
- glVertex2f(x + xoffs, y + yoffs);
+ _hud->_line_list.add(LineSegment(prevX + xoffs, prevY + yoffs,
+ x + xoffs, y + yoffs));
+ prevX = x;
+ prevY = y;
}
- glEnd();
}
void HUD::Item::draw_bullet(float x, float y, float size)