hedgewars/uRender.pas
changeset 9666 8dcb25112d96
parent 9557 a5005b7ca305
child 9792 59cde1e53ca5
--- a/hedgewars/uRender.pas	Thu Oct 31 21:13:07 2013 -0400
+++ b/hedgewars/uRender.pas	Fri Nov 01 23:50:13 2013 +0400
@@ -52,6 +52,8 @@
 
 procedure Tint                  (r, g, b, a: Byte); inline;
 procedure Tint                  (c: Longword); inline;
+procedure untint(); inline;
+procedure setTintAdd            (f: boolean); inline;
 
 
 implementation
@@ -372,7 +374,7 @@
 
     glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
     glDrawArrays(GL_LINES, 0, Length(VertexBuffer));
-    Tint($FF, $FF, $FF, $FF);
+    untint;
     
     glPopMatrix;
     
@@ -405,7 +407,7 @@
 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
 
-Tint($FF, $FF, $FF, $FF);
+untint;
 glEnable(GL_TEXTURE_2D)
 end;
 
@@ -413,7 +415,7 @@
 begin
     Tint(r, g, b, a);
     DrawCircle(X, Y, Radius, Width); 
-    Tint($FF, $FF, $FF, $FF);
+    untint;
 end;
 
 procedure DrawCircle(X, Y, Radius, Width: LongInt); 
@@ -527,7 +529,7 @@
         begin
         Tint($FF, $FF, $FF, alpha);
         DrawTexture(frame.x, frame.y, spritesData[sprite].Texture, buttonScale);
-        Tint($FF, $FF, $FF, $FF);
+        untint;
         end;
     end;
 {$ELSE}
@@ -564,4 +566,17 @@
     Tint(((c shr 24) and $FF), ((c shr 16) and $FF), (c shr 8) and $FF, (c and $FF))
 end;
 
+procedure untint(); inline;
+begin
+    Tint($FF, $FF, $FF, $FF)
+end;
+
+procedure setTintAdd(f: boolean); inline;
+begin
+    if f then
+        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD)
+    else
+        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+end;
+
 end.