hedgewars/uWorld.pas
changeset 6683 75a1d84ac606
parent 6682 bf3cf6e60673
child 6685 ef706fccfb0a
equal deleted inserted replaced
6682:bf3cf6e60673 6683:75a1d84ac606
   209 procedure InitTouchInterface;
   209 procedure InitTouchInterface;
   210 begin
   210 begin
   211 {$IFDEF USE_TOUCH_INTERFACE}
   211 {$IFDEF USE_TOUCH_INTERFACE}
   212 //positioning of the buttons
   212 //positioning of the buttons
   213 buttonScale:= 1.5/cDefaultZoomLevel;
   213 buttonScale:= 1.5/cDefaultZoomLevel;
   214 firebuttonX:= (cScreenWidth shr 1) - Round(spritesData[sprFireButton].Texture^.h * buttonScale);
   214 
   215 firebuttonY:= -Round(spritesData[sprFireButton].Texture^.h* buttonScale) + cScreenHeight;
   215 //TODO: add sensible hOffset and vOffset values
   216 firebuttonW:= Round(spritesData[sprFireButton].Texture^.w * buttonScale);
   216 firebutton.x:= (cScreenWidth shr 1) - Round(spritesData[sprFireButton].Texture^.h * buttonScale);
   217 firebuttonH:= Round(spritesData[sprFireButton].Texture^.h * buttonScale);
   217 firebutton.y:= -Round(spritesData[sprFireButton].Texture^.h* buttonScale) + cScreenHeight;
   218 
   218 firebutton.width:= Round(spritesData[sprFireButton].Texture^.w * buttonScale);
   219 backjumpX:= (cScreenWidth shr 1) - Round(spritesData[sprbackjump].Texture^.h * 2 * buttonScale);
   219 firebutton.height:= Round(spritesData[sprFireButton].Texture^.h * buttonScale);
   220 backjumpY:= -Round(spritesData[sprbackjump].Texture^.h * 1.2 *  buttonScale) + cScreenHeight;
   220 firebutton.hOffset:= 0;
   221 backjumpW:= Round(spritesData[sprbackjump].Texture^.w * buttonScale);
   221 firebutton.vOffset:= 0;
   222 backjumpH:= Round(spritesData[sprbackjump].Texture^.h * buttonScale);
   222 
   223 
   223 backjump.x:= (cScreenWidth shr 1) - Round(spritesData[sprbackjump].Texture^.h * 2 * buttonScale);
   224 forwardjumpX:= (cScreenWidth shr 1) - Round(spritesData[sprforwardjump].Texture^.h * 1.2 * buttonScale);
   224 backjump.y:= -Round(spritesData[sprbackjump].Texture^.h * 1.2 *  buttonScale) + cScreenHeight;
   225 forwardjumpY:= -Round(spritesData[sprforwardjump].Texture^.h * 2 * buttonScale) + cScreenHeight;
   225 backjump.width:= Round(spritesData[sprbackjump].Texture^.w * buttonScale);
   226 forwardjumpW:= Round(spritesData[sprforwardjump].Texture^.w * buttonScale);
   226 backjump.height:= Round(spritesData[sprbackjump].Texture^.h * buttonScale);
   227 forwardjumpH:= Round(spritesData[sprforwardjump].Texture^.h * buttonScale);
   227 backjump.hOffset:= 0;
   228 
   228 backjump.vOffset:= 0;
   229 arrowLeftX:= -(cScreenWidth shr 1);
   229 
   230 arrowLeftY:= -Round(spritesData[sprArrowLeft].Texture^.h*buttonScale) + cScreenHeight  - Round(spritesData[sprArrowLeft].Texture^.h*buttonScale);
   230 forwardjump.x:= (cScreenWidth shr 1) - Round(spritesData[sprforwardjump].Texture^.h * 1.2 * buttonScale);
   231 arrowLeftW:= Round(spritesData[sprArrowLeft].Texture^.h * buttonScale);
   231 forwardjump.y:= -Round(spritesData[sprforwardjump].Texture^.h * 2 * buttonScale) + cScreenHeight;
   232 arrowLeftH:= Round(spritesData[sprArrowLeft].Texture^.h * buttonScale);
   232 forwardjump.width:= Round(spritesData[sprforwardjump].Texture^.w * buttonScale);
   233 
   233 forwardjump.height:= Round(spritesData[sprforwardjump].Texture^.h * buttonScale);
   234 arrowRightX:= -(cScreenWidth shr 1)+ Round(spritesData[sprArrowUp].Texture^.h * buttonScale *2);
   234 forwardjump.hOffset:= 0;
   235 arrowRightY:= -Round(spritesData[sprArrowRight].Texture^.h*buttonScale) + cScreenHeight - Round(spritesData[sprArrowRight].Texture^.h*buttonScale);
   235 forwardjump.vOffset:= 0;
   236 arrowRightW:= Round(spritesData[sprArrowRight].Texture^.w * buttonScale);
   236 
   237 arrowRightH:= Round(spritesData[sprArrowRight].Texture^.h * buttonScale);
   237 arrowLeft.x:= -(cScreenWidth shr 1);
   238 
   238 arrowLeft.y:= -Round(spritesData[sprArrowLeft].Texture^.h*buttonScale) + cScreenHeight  - Round(spritesData[sprArrowLeft].Texture^.h*buttonScale);
   239 arrowUpX:= -(cScreenWidth shr 1) + Round(spritesData[sprArrowUp].Texture^.h * buttonScale);
   239 arrowLeft.width:= Round(spritesData[sprArrowLeft].Texture^.h * buttonScale);
   240 arrowUpY:= -Round(spritesData[sprArrowUp].Texture^.h*buttonScale) + cScreenHeight - Round(spritesData[sprArrowUp].Texture^.h*buttonScale*2);
   240 arrowLeft.height:= Round(spritesData[sprArrowLeft].Texture^.h * buttonScale);
   241 arrowUpW:= Round(spritesData[sprArrowUp].Texture^.w * buttonScale);
   241 arrowLeft.hOffset:= 0;
   242 arrowUpH:= Round(spritesData[sprArrowUp].Texture^.h * buttonScale);
   242 arrowLeft.vOffset:= 0;
   243 
   243 
   244 arrowDownX:= -(cScreenWidth shr 1) + Round(spritesData[sprArrowUp].Texture^.h * buttonScale);
   244 arrowRight.x:= -(cScreenWidth shr 1)+ Round(spritesData[sprArrowUp].Texture^.h * buttonScale *2);
   245 arrowDownY:= -Round(spritesData[sprArrowDown].Texture^.h*buttonscale) + cScreenHeight;
   245 arrowRight.y:= -Round(spritesData[sprArrowRight].Texture^.h*buttonScale) + cScreenHeight - Round(spritesData[sprArrowRight].Texture^.h*buttonScale);
   246 arrowDownW:= Round(spritesData[sprArrowDown].Texture^.w * buttonScale);
   246 arrowRight.width:= Round(spritesData[sprArrowRight].Texture^.w * buttonScale);
   247 arrowDownH:= Round(spritesData[sprArrowDown].Texture^.h * buttonScale);
   247 arrowRight.height:= Round(spritesData[sprArrowRight].Texture^.h * buttonScale);
       
   248 arrowRight.hOffset:= 0;
       
   249 arrowRight.vOffset:= 0;
       
   250 
       
   251 arrowUp.x:= -(cScreenWidth shr 1) + Round(spritesData[sprArrowUp].Texture^.h * buttonScale);
       
   252 arrowUp.y:= -Round(spritesData[sprArrowUp].Texture^.h*buttonScale) + cScreenHeight - Round(spritesData[sprArrowUp].Texture^.h*buttonScale*2);
       
   253 arrowUp.width:= Round(spritesData[sprArrowUp].Texture^.w * buttonScale);
       
   254 arrowUp.height:= Round(spritesData[sprArrowUp].Texture^.h * buttonScale);
       
   255 arrowUp.hOffset:= 0;
       
   256 arrowUp.vOffset:= 0;
       
   257 
       
   258 arrowDown.x:= -(cScreenWidth shr 1) + Round(spritesData[sprArrowUp].Texture^.h * buttonScale);
       
   259 arrowDown.y:= -Round(spritesData[sprArrowDown].Texture^.h*buttonscale) + cScreenHeight;
       
   260 arrowDown.width:= Round(spritesData[sprArrowDown].Texture^.w * buttonScale);
       
   261 arrowDown.height:= Round(spritesData[sprArrowDown].Texture^.h * buttonScale);
       
   262 arrowDown.hOffset:= 0;
       
   263 arrowDown.vOffset:= 0;
   248 {$ENDIF}
   264 {$ENDIF}
   249 end;
   265 end;
   250 
   266 
   251 // for uStore texture resetting
   267 // for uStore texture resetting
   252 procedure ResetWorldTex;
   268 procedure ResetWorldTex;
  1093 // Captions
  1109 // Captions
  1094 DrawCaptions;
  1110 DrawCaptions;
  1095 
  1111 
  1096 {$IFDEF USE_TOUCH_INTERFACE}
  1112 {$IFDEF USE_TOUCH_INTERFACE}
  1097 // Draw buttons Related to the Touch interface
  1113 // Draw buttons Related to the Touch interface
  1098 DrawTexture(arrowLeftX, arrowLeftY,spritesData[sprArrowLeft].Texture, buttonScale);
  1114 DrawTexture(arrowLeft.x, arrowLeft.y, spritesData[sprArrowLeft].Texture, buttonScale);
  1099 DrawTexture(arrowRightX, arrowRightY,spritesData[sprArrowRight].Texture, buttonScale);
  1115 DrawTexture(arrowRight.x, arrowRight.y, spritesData[sprArrowRight].Texture, buttonScale);
  1100 DrawTexture(arrowUpX, arrowUpY,spritesData[sprArrowUp].Texture, buttonScale);
  1116 DrawTexture(arrowUp.x, arrowUp.y, spritesData[sprArrowUp].Texture, buttonScale);
  1101 DrawTexture(arrowDownX, arrowDownY,spritesData[sprArrowDown].Texture, buttonScale);
  1117 DrawTexture(arrowDown.x, arrowDown.y, spritesData[sprArrowDown].Texture, buttonScale);
  1102 
  1118 
  1103 DrawTexture(fireButtonX, firebuttonY, spritesData[sprFireButton].Texture, buttonScale);
  1119 DrawTexture(fireButton.x, firebutton.y, spritesData[sprFireButton].Texture, buttonScale);
  1104 DrawTexture(backjumpX, backjumpY, spritesData[sprBackjump].Texture, buttonScale);
  1120 DrawTexture(backjump.x, backjump.y, spritesData[sprBackjump].Texture, buttonScale);
  1105 DrawTexture(forwardjumpX, forwardjumpY, spritesData[sprForwardjump].Texture, buttonScale);
  1121 DrawTexture(forwardjump.x, forwardjump.y, spritesData[sprForwardjump].Texture, buttonScale);
  1106 {$ENDIF}
  1122 {$ENDIF}
  1107 
  1123 
  1108 // Teams Healths
  1124 // Teams Healths
  1109 if TeamsCount * 20 > Longword(cScreenHeight) div 7 then  // take up less screen on small displays
  1125 if TeamsCount * 20 > Longword(cScreenHeight) div 7 then  // take up less screen on small displays
  1110     begin
  1126     begin