--- a/hedgewars/uWorld.pas Fri Oct 11 11:55:31 2013 +0200
+++ b/hedgewars/uWorld.pas Fri Oct 11 17:43:13 2013 +0200
@@ -247,7 +247,7 @@
{$IFDEF USE_TOUCH_INTERFACE}
//positioning of the buttons
-buttonScale:= mobileRecord.getScreenDPI()/cDefaultZoomLevel;
+buttonScale:= 1 / cDefaultZoomLevel;
with JumpWidget do
@@ -1172,6 +1172,8 @@
highlight: Boolean;
smallScreenOffset, offsetX, offsetY, screenBottom: LongInt;
VertexBuffer: array [0..3] of TVertex2f;
+ lw, lh: GLfloat;
+ WorldEnd, WorldFade : array[0..3] of HwColor4f;
begin
if (cReducedQuality and rqNoBackground) = 0 then
begin
@@ -1302,6 +1304,76 @@
end;
{$WARNINGS ON}
+if WorldEdge <> weNone then
+ begin
+(* I think for a bounded world, will fill the left and right areas with black or something. Also will probably want various border effects/animations based on border type. Prob also, say, trigger a border animation timer on an impact. *)
+
+ FillChar(WorldFade, sizeof(WorldFade), 0);
+ WorldFade[0].a:= 255;
+ WorldFade[1].a:= 255;
+ FillChar(WorldEnd, sizeof(WorldEnd), 0);
+ WorldEnd[0].a:= 255;
+ WorldEnd[1].a:= 255;
+ WorldEnd[2].a:= 255;
+ WorldEnd[3].a:= 255;
+
+ glDisable(GL_TEXTURE_2D);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glEnableClientState(GL_COLOR_ARRAY);
+
+ glPushMatrix;
+ glTranslatef(WorldDx, WorldDy, 0);
+ glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WorldFade[0]);
+
+ VertexBuffer[0].X:= leftX-20;
+ VertexBuffer[0].Y:= -3000;
+ VertexBuffer[1].X:= leftX-20;
+ VertexBuffer[1].Y:= cWaterLine+cVisibleWater;
+ VertexBuffer[2].X:= leftX+30;
+ VertexBuffer[2].Y:= cWaterLine+cVisibleWater;
+ VertexBuffer[3].X:= leftX+30;
+ VertexBuffer[3].Y:= -3000;
+
+ glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
+ glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
+
+ VertexBuffer[0].X:= rightX+20;
+ VertexBuffer[1].X:= rightX+20;
+ VertexBuffer[2].X:= rightX-30;
+ VertexBuffer[3].X:= rightX-30;
+
+ glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
+ glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
+
+ glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WorldEnd[0]);
+
+ VertexBuffer[0].X:= -5000;
+ VertexBuffer[1].X:= -5000;
+ VertexBuffer[2].X:= leftX-20;
+ VertexBuffer[3].X:= leftX-20;
+
+ glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
+ glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
+
+ VertexBuffer[0].X:= rightX+5000;
+ VertexBuffer[1].X:= rightX+5000;
+ VertexBuffer[2].X:= rightX+20;
+ VertexBuffer[3].X:= rightX+20;
+
+ glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
+ glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
+
+ glPopMatrix;
+ glDisableClientState(GL_COLOR_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+
+ glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required
+ glEnable(GL_TEXTURE_2D);
+
+ DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 3.0, $FF, $00, $FF, $FF);
+ DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 3.0, $FF, $00, $FF, $FF);
+ end;
+
// this scale is used to keep the various widgets at the same dimension at all zoom levels
SetScale(cDefaultZoomLevel);