ifdefing out c++11 syntax so OSX compiles

This commit is contained in:
pierow 2018-08-12 21:42:12 -04:00
parent 0960ad6c53
commit ea8940c0ff
4 changed files with 24 additions and 0 deletions

View file

@ -185,6 +185,9 @@ int CHudCrosshairs::Draw(float time)
gl.line(Vector2D(center.x + gap + size, center.y), Vector2D(center.x + gap, center.y)); gl.line(Vector2D(center.x + gap + size, center.y), Vector2D(center.x + gap, center.y));
} }
#ifdef __APPLE__
//Remove when OSX builds with c++11
#else
// Draw the circle. // Draw the circle.
if (cl_cross_circle_radius->value > 0.0f) { if (cl_cross_circle_radius->value > 0.0f) {
gl.line_width(1.0f); gl.line_width(1.0f);
@ -198,6 +201,7 @@ int CHudCrosshairs::Draw(float time)
gl.circle(center, circle_points); gl.circle(center, circle_points);
} }
#endif
// Draw the dot. // Draw the dot.
if (cl_cross_dot_size->value > 0.0f) { if (cl_cross_dot_size->value > 0.0f) {

View file

@ -24,8 +24,12 @@ class CHudCrosshairs : public CHudBase
cvar_t* cl_cross_line_left; cvar_t* cl_cross_line_left;
cvar_t* cl_cross_line_right; cvar_t* cl_cross_line_right;
#ifdef __APPLE__
//Remove when OSX builds with c++11
#else
float old_circle_radius; float old_circle_radius;
std::vector<Vector2D> circle_points; std::vector<Vector2D> circle_points;
#endif
public: public:
virtual int Init(); virtual int Init();

View file

@ -52,6 +52,9 @@ void HudGL::line(const Vector2D& start, const Vector2D& end) const {
glEnd(); glEnd();
} }
#ifdef __APPLE__
//Remove when OSX builds with c++11
#else
void HudGL::circle(const Vector2D& center, const std::vector<Vector2D>& points) const { void HudGL::circle(const Vector2D& center, const std::vector<Vector2D>& points) const {
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
@ -61,6 +64,7 @@ void HudGL::circle(const Vector2D& center, const std::vector<Vector2D>& points)
glVertex2f(center.x + points[0].x, center.y + points[0].y); glVertex2f(center.x + points[0].x, center.y + points[0].y);
glEnd(); glEnd();
} }
#endif
void HudGL::rectangle(const Vector2D& corner_a, const Vector2D& corner_b) const { void HudGL::rectangle(const Vector2D& corner_a, const Vector2D& corner_b) const {
glBegin(GL_QUADS); glBegin(GL_QUADS);
@ -71,6 +75,9 @@ void HudGL::rectangle(const Vector2D& corner_a, const Vector2D& corner_b) const
glEnd(); glEnd();
} }
#ifdef __APPLE__
//Remove when OSX builds with c++11
#else
std::vector<Vector2D> HudGL::compute_circle(float radius) { std::vector<Vector2D> HudGL::compute_circle(float radius) {
// Maximum allowed distance between the circle and the rendered line segment. // Maximum allowed distance between the circle and the rendered line segment.
const float MAX_ERROR = 0.1f; const float MAX_ERROR = 0.1f;
@ -87,3 +94,4 @@ std::vector<Vector2D> HudGL::compute_circle(float radius) {
return points; return points;
} }
#endif

View file

@ -9,8 +9,16 @@ public:
void color(unsigned char r, unsigned char g, unsigned char b, unsigned char a) const; void color(unsigned char r, unsigned char g, unsigned char b, unsigned char a) const;
void line_width(float width) const; void line_width(float width) const;
void line(const Vector2D& start, const Vector2D& end) const; void line(const Vector2D& start, const Vector2D& end) const;
#ifdef __APPLE__
//Remove when OSX builds with c++11
#else
void circle(const Vector2D& center, const std::vector<Vector2D>& points) const; void circle(const Vector2D& center, const std::vector<Vector2D>& points) const;
#endif
void rectangle(const Vector2D& corner_a, const Vector2D& corner_b) const; void rectangle(const Vector2D& corner_a, const Vector2D& corner_b) const;
#ifdef __APPLE__
//Remove when OSX builds with c++11
#else
static std::vector<Vector2D> compute_circle(float radius); static std::vector<Vector2D> compute_circle(float radius);
#endif
}; };