project_files/HedgewarsMobile/Classes/OverlayViewController.m
changeset 3637 0db298524c3d
parent 3635 38d3e31556d3
child 3638 33ee433749ba
equal deleted inserted replaced
3636:c0d82112f479 3637:0db298524c3d
   394             HW_saveCursor(TRUE);
   394             HW_saveCursor(TRUE);
   395             
   395             
   396             // and remove the label (if any)
   396             // and remove the label (if any)
   397             [[self.view viewWithTag:5599] removeFromSuperview];
   397             [[self.view viewWithTag:5599] removeFromSuperview];
   398         } else {
   398         } else {
   399             // TODO: only do this if the weapon does require a further click
   399             // if weapon requires a further click, ask for tapping again
   400             // if no click, then ask for tapping again
   400             if (HW_isWeaponRequiringClick()) {
   401             CGPoint currentPosition = [[touches anyObject] locationInView:self.view];
   401                 CGPoint currentPosition = [[touches anyObject] locationInView:self.view];
   402             UILabel *tapAgain = [[UILabel alloc] initWithFrame:CGRectMake(currentPosition.x-100, currentPosition.y + 10, 200, 25)];
   402                 UILabel *tapAgain = [[UILabel alloc] initWithFrame:CGRectMake(currentPosition.x-100, currentPosition.y + 10, 200, 25)];
   403             tapAgain.text = NSLocalizedString(@"Tap again to confirm",@"from the overlay");
   403                 tapAgain.text = NSLocalizedString(@"Tap again to confirm",@"from the overlay");
   404             tapAgain.backgroundColor = [UIColor clearColor];
   404                 tapAgain.backgroundColor = [UIColor clearColor];
   405             tapAgain.tag = 5599;
   405                 tapAgain.tag = 5599;
   406             tapAgain.textColor = [UIColor blueColor];
   406                 tapAgain.textColor = [UIColor blueColor];
   407             tapAgain.textAlignment = UITextAlignmentCenter;
   407                 tapAgain.textAlignment = UITextAlignmentCenter;
   408             tapAgain.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
   408                 tapAgain.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];
   409             [self.view addSubview:tapAgain];
   409                 [self.view addSubview:tapAgain];
   410             [tapAgain release];
   410                 [tapAgain release];
       
   411             }
   411         }
   412         }
   412 
   413 
   413     pointWhereToClick = CGPointZero;
   414     pointWhereToClick = CGPointZero;
   414     initialDistanceForPinching = 0;
   415     initialDistanceForPinching = 0;
   415     isSingleClick = NO;
   416     isSingleClick = NO;
   430     switch ([touches count]) {
   431     switch ([touches count]) {
   431         case 1:
   432         case 1:
   432             isSingleClick = NO;
   433             isSingleClick = NO;
   433             currentPosition = [touch locationInView:self.view];
   434             currentPosition = [touch locationInView:self.view];
   434             if (HW_isAmmoOpen()) {
   435             if (HW_isAmmoOpen()) {
   435                 DLog(@"X:%d Y:%d", HWX(currentPosition.x), HWY(currentPosition.y));
   436                 // saves the point on which to select the ammo
       
   437                 pointWhereToClick = currentPosition;
       
   438                 // moves the cursor over
   436                 HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y));
   439                 HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y));
   437                 pointWhereToClick = currentPosition;
       
   438             } else {
   440             } else {
   439                 DLog(@"x: %f y: %f -> X:%d Y:%d", currentPosition.x, currentPosition.y, HWX(currentPosition.x), HWY(currentPosition.y));
   441                 DLog(@"x: %f y: %f -> X:%d Y:%d", currentPosition.x, currentPosition.y, HWX(currentPosition.x), HWY(currentPosition.y));
   440                 HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y));
   442                 HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y));
   441             }
   443             }
   442             break;
   444             break;