summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/render/safeopenglgraphics.cpp28
-rw-r--r--src/render/safeopenglgraphics.h4
2 files changed, 28 insertions, 4 deletions
diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp
index 717e7d5bf..c988e6825 100644
--- a/src/render/safeopenglgraphics.cpp
+++ b/src/render/safeopenglgraphics.cpp
@@ -566,17 +566,37 @@ void SafeOpenGLGraphics::drawPoint(int x, int y)
glEnd();
}
-void SafeOpenGLGraphics::drawLine(int x1, int y1, int x2, int y2)
+bool SafeOpenGLGraphics::drawNet(const int x1, const int y1,
+ const int x2, const int y2,
+ const int width, const int height)
{
setTexturingAndBlending(false);
restoreColor();
glBegin(GL_LINES);
- glVertex2f(static_cast<float>(x1) + 0.5F, static_cast<float>(y1) + 0.5F);
- glVertex2f(static_cast<float>(x2) + 0.5F, static_cast<float>(y2) + 0.5F);
+ for (int y = y1; y < y2; y += height)
+ {
+ glVertex2f(static_cast<float>(x1) + 0.5F, static_cast<float>(y) + 0.5F);
+ glVertex2f(static_cast<float>(x2) + 0.5F, static_cast<float>(y) + 0.5F);
+ }
+
+ for (int x = x1; x < x2; x += width)
+ {
+ glVertex2f(static_cast<float>(x) + 0.5F, static_cast<float>(y1) + 0.5F);
+ glVertex2f(static_cast<float>(x) + 0.5F, static_cast<float>(y2) + 0.5F);
+ }
glEnd();
- glBegin(GL_POINTS);
+ return true;
+}
+
+void SafeOpenGLGraphics::drawLine(int x1, int y1, int x2, int y2)
+{
+ setTexturingAndBlending(false);
+ restoreColor();
+
+ glBegin(GL_LINES);
+ glVertex2f(static_cast<float>(x1) + 0.5F, static_cast<float>(y1) + 0.5F);
glVertex2f(static_cast<float>(x2) + 0.5F, static_cast<float>(y2) + 0.5F);
glEnd();
}
diff --git a/src/render/safeopenglgraphics.h b/src/render/safeopenglgraphics.h
index 36ce27ded..c4bfd46de 100644
--- a/src/render/safeopenglgraphics.h
+++ b/src/render/safeopenglgraphics.h
@@ -59,6 +59,10 @@ class SafeOpenGLGraphics final : public Graphics
void drawImageRect(int x, int y, int w, int h,
const ImageRect &imgRect);
+ bool drawNet(const int x1, const int y1,
+ const int x2, const int y2,
+ const int width, const int height) override final;
+
protected:
void setTexturingAndBlending(const bool enable);