hedgewars/uRender.pas
changeset 10360 c243b6a8ad9a
parent 10354 56bd029245fc
child 10404 1baaab44a0b2
child 10427 dd44d2c8fd0e
--- a/hedgewars/uRender.pas	Sun Jul 06 12:19:24 2014 +0200
+++ b/hedgewars/uRender.pas	Sun Jul 06 19:20:43 2014 +0200
@@ -51,6 +51,7 @@
 
 procedure DrawLine              (X0, Y0, X1, Y1, Width: Single; color: LongWord); inline;
 procedure DrawLine              (X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
+procedure DrawLineOnScreen      (X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
 procedure DrawRect              (rect: TSDL_Rect; r, g, b, a: Byte; Fill: boolean);
 procedure DrawHedgehog          (X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real);
 procedure DrawScreenWidget      (widget: POnScreenWidget);
@@ -1093,16 +1094,24 @@
 
 procedure DrawLine(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
 begin
+    openglPushMatrix();
+    openglTranslatef(WorldDx, WorldDy, 0);
+
+    UpdateModelviewProjection;
+
+    DrawLineOnScreen(X0, Y0, X1, Y1, Width, r, g, b, a);
+
+    openglPopMatrix();
+end;
+
+procedure DrawLineOnScreen(X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
+begin
     glEnable(GL_LINE_SMOOTH);
 
     EnableTexture(False);
 
-    openglPushMatrix;
-    openglTranslatef(WorldDx, WorldDy, 0);
     glLineWidth(Width);
 
-    UpdateModelviewProjection;
-
     Tint(r, g, b, a);
     VertexBuffer[0].X:= X0;
     VertexBuffer[0].Y:= Y0;
@@ -1111,9 +1120,7 @@
 
     SetVertexPointer(@VertexBuffer[0], 2);
     glDrawArrays(GL_LINES, 0, 2);
-    untint;
-
-    openglPopMatrix;
+    untint();
 
     EnableTexture(True);