hedgewars/uWorld.pas
branchwebgl
changeset 9521 8054d9d775fd
parent 9127 e350500c4edb
parent 9485 3dee8a3b0406
child 9950 2759212a27de
equal deleted inserted replaced
9282:92af50454cf2 9521:8054d9d775fd
   245 procedure InitTouchInterface;
   245 procedure InitTouchInterface;
   246 begin
   246 begin
   247 {$IFDEF USE_TOUCH_INTERFACE}
   247 {$IFDEF USE_TOUCH_INTERFACE}
   248 
   248 
   249 //positioning of the buttons
   249 //positioning of the buttons
   250 buttonScale:= mobileRecord.getScreenDPI()/cDefaultZoomLevel;
   250 buttonScale:= 1 / cDefaultZoomLevel;
   251 
   251 
   252 
   252 
   253 with JumpWidget do
   253 with JumpWidget do
   254     begin
   254     begin
   255     show:= true;
   255     show:= true;
  1170     tdx, tdy: Double;
  1170     tdx, tdy: Double;
  1171     s: shortstring;
  1171     s: shortstring;
  1172     highlight: Boolean;
  1172     highlight: Boolean;
  1173     smallScreenOffset, offsetX, offsetY, screenBottom: LongInt;
  1173     smallScreenOffset, offsetX, offsetY, screenBottom: LongInt;
  1174     VertexBuffer: array [0..3] of TVertex2f;
  1174     VertexBuffer: array [0..3] of TVertex2f;
       
  1175     lw, lh: GLfloat;
       
  1176     WorldEnd, WorldFade : array[0..3] of HwColor4f;
  1175 begin
  1177 begin
  1176 if (cReducedQuality and rqNoBackground) = 0 then
  1178 if (cReducedQuality and rqNoBackground) = 0 then
  1177     begin
  1179     begin
  1178         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
  1180         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
  1179         ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
  1181         ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
  1299         else
  1301         else
  1300             DrawSpriteRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
  1302             DrawSpriteRotatedF(sprTargetP, TargetPoint.X + WorldDx, TargetPoint.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
  1301         end
  1303         end
  1302     end;
  1304     end;
  1303 {$WARNINGS ON}
  1305 {$WARNINGS ON}
       
  1306 
       
  1307 if WorldEdge <> weNone then
       
  1308     begin
       
  1309 (* 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. *)
       
  1310 
       
  1311     FillChar(WorldFade, sizeof(WorldFade), 0);
       
  1312     WorldFade[0].a:= 255;
       
  1313     WorldFade[1].a:= 255;
       
  1314     FillChar(WorldEnd, sizeof(WorldEnd), 0);
       
  1315     WorldEnd[0].a:= 255;
       
  1316     WorldEnd[1].a:= 255;
       
  1317     WorldEnd[2].a:= 255;
       
  1318     WorldEnd[3].a:= 255;
       
  1319 
       
  1320     glDisable(GL_TEXTURE_2D);
       
  1321     glDisableClientState(GL_TEXTURE_COORD_ARRAY);
       
  1322     glEnableClientState(GL_COLOR_ARRAY);
       
  1323 
       
  1324     glPushMatrix;
       
  1325     glTranslatef(WorldDx, WorldDy, 0);
       
  1326     glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WorldFade[0]);
       
  1327 
       
  1328     VertexBuffer[0].X:= leftX-20;
       
  1329     VertexBuffer[0].Y:= -3000;
       
  1330     VertexBuffer[1].X:= leftX-20;
       
  1331     VertexBuffer[1].Y:= cWaterLine+cVisibleWater;
       
  1332     VertexBuffer[2].X:= leftX+30;
       
  1333     VertexBuffer[2].Y:= cWaterLine+cVisibleWater;
       
  1334     VertexBuffer[3].X:= leftX+30;
       
  1335     VertexBuffer[3].Y:= -3000;
       
  1336 
       
  1337     glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
  1338     glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
       
  1339 
       
  1340     VertexBuffer[0].X:= rightX+20;
       
  1341     VertexBuffer[1].X:= rightX+20;
       
  1342     VertexBuffer[2].X:= rightX-30;
       
  1343     VertexBuffer[3].X:= rightX-30;
       
  1344 
       
  1345     glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
  1346     glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
       
  1347 
       
  1348     glColorPointer(4, GL_UNSIGNED_BYTE, 0, @WorldEnd[0]);
       
  1349 
       
  1350     VertexBuffer[0].X:= -5000;
       
  1351     VertexBuffer[1].X:= -5000;
       
  1352     VertexBuffer[2].X:= leftX-20;
       
  1353     VertexBuffer[3].X:= leftX-20;
       
  1354 
       
  1355     glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
  1356     glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
       
  1357 
       
  1358     VertexBuffer[0].X:= rightX+5000;
       
  1359     VertexBuffer[1].X:= rightX+5000;
       
  1360     VertexBuffer[2].X:= rightX+20;
       
  1361     VertexBuffer[3].X:= rightX+20;
       
  1362 
       
  1363     glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]);
       
  1364     glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer));
       
  1365 
       
  1366     glPopMatrix;
       
  1367     glDisableClientState(GL_COLOR_ARRAY);
       
  1368     glEnableClientState(GL_TEXTURE_COORD_ARRAY);
       
  1369 
       
  1370     glColor4ub($FF, $FF, $FF, $FF); // must not be Tint() as color array seems to stay active and color reset is required
       
  1371     glEnable(GL_TEXTURE_2D);
       
  1372 
       
  1373     DrawLine(leftX, -3000, leftX, cWaterLine+cVisibleWater, 3.0, $FF, $00, $FF, $FF);
       
  1374     DrawLine(rightX, -3000, rightX, cWaterLine+cVisibleWater, 3.0, $FF, $00, $FF, $FF);
       
  1375     end;
  1304 
  1376 
  1305 // this scale is used to keep the various widgets at the same dimension at all zoom levels
  1377 // this scale is used to keep the various widgets at the same dimension at all zoom levels
  1306 SetScale(cDefaultZoomLevel);
  1378 SetScale(cDefaultZoomLevel);
  1307 
  1379 
  1308 // Turn time
  1380 // Turn time