hedgewars/uWorld.pas
changeset 6637 b4a3310f2974
parent 6631 930d5f070196
child 6638 4cb7c055dca1
equal deleted inserted replaced
6635:c2fa29fe2a58 6637:b4a3310f2974
   196 
   196 
   197 //aligns it to the bottom of the screen, minus the border
   197 //aligns it to the bottom of the screen, minus the border
   198 SkyOffset:= 0;
   198 SkyOffset:= 0;
   199 HorizontOffset:= 0;
   199 HorizontOffset:= 0;
   200 
   200 
       
   201 {$IFDEF ANDROID}
       
   202 //positioning of the buttons
       
   203 buttonScale:= 1.5/cDefaultZoomLevel;
       
   204 firebuttonX:= (cScreenWidth shr 1) - Round(spritesData[sprFireButton].Texture^.h * buttonScale);
       
   205 firebuttonY:= -Round(spritesData[sprFireButton].Texture^.h* buttonScale) + cScreenHeight;
       
   206 firebuttonW:= Round(spritesData[sprFireButton].Texture^.w * buttonScale);
       
   207 firebuttonH:= Round(spritesData[sprFireButton].Texture^.h * buttonScale);
       
   208 
       
   209 backjumpX:= (cScreenWidth shr 1) - Round(spritesData[sprbackjump].Texture^.h * 2 * buttonScale);
       
   210 backjumpY:= -Round(spritesData[sprbackjump].Texture^.h * 1.2 *  buttonScale) + cScreenHeight;
       
   211 backjumpW:= Round(spritesData[sprbackjump].Texture^.w * buttonScale);
       
   212 backjumpH:= Round(spritesData[sprbackjump].Texture^.h * buttonScale);
       
   213 
       
   214 forwardjumpX:= (cScreenWidth shr 1) - Round(spritesData[sprforwardjump].Texture^.h * 1.2 * buttonScale);
       
   215 forwardjumpY:= -Round(spritesData[sprforwardjump].Texture^.h * 2 * buttonScale) + cScreenHeight;
       
   216 forwardjumpW:= Round(spritesData[sprforwardjump].Texture^.w * buttonScale);
       
   217 forwardjumpH:= Round(spritesData[sprforwardjump].Texture^.h * buttonScale);
       
   218 
       
   219 arrowLeftX:= -(cScreenWidth shr 1);
       
   220 arrowLeftY:= -Round(spritesData[sprArrowLeft].Texture^.h*buttonScale) + cScreenHeight  - Round(spritesData[sprArrowLeft].Texture^.h*buttonScale);
       
   221 arrowLeftW:= Round(spritesData[sprArrowLeft].Texture^.h * buttonScale);
       
   222 arrowLeftH:= Round(spritesData[sprArrowLeft].Texture^.h * buttonScale);
       
   223 
       
   224 arrowRightX:= -(cScreenWidth shr 1)+ Round(spritesData[sprArrowUp].Texture^.h * buttonScale *2);
       
   225 arrowRightY:= -Round(spritesData[sprArrowRight].Texture^.h*buttonScale) + cScreenHeight - Round(spritesData[sprArrowRight].Texture^.h*buttonScale);
       
   226 arrowLeftW:= Round(spritesData[sprArrowRight].Texture^.w * buttonScale);
       
   227 arrowLeftH:= Round(spritesData[sprArrowRight].Texture^.h * buttonScale);
       
   228 
       
   229 arrowUpX:= -(cScreenWidth shr 1) + Round(spritesData[sprArrowUp].Texture^.h * buttonScale);
       
   230 arrowUpY:= -Round(spritesData[sprArrowUp].Texture^.h*buttonScale) + cScreenHeight - Round(spritesData[sprArrowUp].Texture^.h*buttonScale*2);
       
   231 arrowUpW:= Round(spritesData[sprArrowUp].Texture^.w * buttonScale);
       
   232 arrowUpH:= Round(spritesData[sprArrowUp].Texture^.h * buttonScale);
       
   233 
       
   234 arrowDownX:= -(cScreenWidth shr 1) + Round(spritesData[sprArrowUp].Texture^.h * buttonScale);
       
   235 arrowDownY:= -Round(spritesData[sprArrowDown].Texture^.h*buttonscale) + cScreenHeight;
       
   236 arrowDownW:= Round(spritesData[sprArrowDown].Texture^.w * buttonScale);
       
   237 arrowDownH:= Round(spritesData[sprArrowDown].Texture^.h * buttonScale);
       
   238 
       
   239 
       
   240 {$ENDIF}
   201 end;
   241 end;
   202 
   242 
   203 procedure InitCameraBorders;
   243 procedure InitCameraBorders;
   204 begin
   244 begin
   205 cGearScrEdgesDist:= min(2 * cScreenHeight div 5, 2 * cScreenWidth div 5);
   245 cGearScrEdgesDist:= min(2 * cScreenHeight div 5, 2 * cScreenWidth div 5);
   885     tdx, tdy: Double;
   925     tdx, tdy: Double;
   886     s: string[15];
   926     s: string[15];
   887     highlight: Boolean;
   927     highlight: Boolean;
   888     smallScreenOffset, offsetX, offsetY, screenBottom: LongInt;
   928     smallScreenOffset, offsetX, offsetY, screenBottom: LongInt;
   889     VertexBuffer: array [0..3] of TVertex2f;
   929     VertexBuffer: array [0..3] of TVertex2f;
       
   930     scale: GLFloat;
   890 begin
   931 begin
   891 if (cReducedQuality and rqNoBackground) = 0 then
   932 if (cReducedQuality and rqNoBackground) = 0 then
   892     begin
   933     begin
   893         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
   934         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
   894         ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
   935         ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
  1051 // Captions
  1092 // Captions
  1052 DrawCaptions;
  1093 DrawCaptions;
  1053 
  1094 
  1054 {$IFDEF ANDROID}
  1095 {$IFDEF ANDROID}
  1055 // Draw buttons Related to the Touch interface
  1096 // Draw buttons Related to the Touch interface
  1056 DrawTexture(Round(-cScreenWidth*0.5 + cScreenHeight*0.02),Round((cScreenHeight*0.98)-(spritesData[sprFireButton].Height*0.4) ),spritesData[sprFireButton].Texture, 0.4);
  1097 DrawTexture(arrowLeftX, arrowLeftY,spritesData[sprArrowLeft].Texture, buttonScale);
       
  1098 DrawTexture(arrowRightX, arrowRightY,spritesData[sprArrowRight].Texture, buttonScale);
       
  1099 DrawTexture(arrowUpX, arrowUpY,spritesData[sprArrowUp].Texture, buttonScale);
       
  1100 DrawTexture(arrowDownX, arrowDownY,spritesData[sprArrowDown].Texture, buttonScale);
       
  1101 
       
  1102 DrawTexture(fireButtonX, firebuttonY, spritesData[sprFireButton].Texture, buttonScale);
       
  1103 DrawTexture(backjumpX, backjumpY, spritesData[sprBackjump].Texture, buttonScale);
       
  1104 DrawTexture(forwardjumpX, forwardjumpY, spritesData[sprForwardjump].Texture, buttonScale);
  1057 {$ENDIF}
  1105 {$ENDIF}
  1058 
  1106 
  1059 // Teams Healths
  1107 // Teams Healths
  1060 if TeamsCount * 20 > Longword(cScreenHeight) div 7 then  // take up less screen on small displays
  1108 if TeamsCount * 20 > Longword(cScreenHeight) div 7 then  // take up less screen on small displays
  1061     begin
  1109     begin