project_files/HedgewarsMobile/Classes/AmmoMenuViewController.m
changeset 5195 1bfa81f0bc21
parent 4976 088d40d8aba2
child 5208 878e551f0b4a
equal deleted inserted replaced
5194:851c6fbb44e6 5195:1bfa81f0bc21
    65 
    65 
    66 -(void) appearInView:(UIView *)container {
    66 -(void) appearInView:(UIView *)container {
    67     [self viewWillAppear:YES];
    67     [self viewWillAppear:YES];
    68     [container addSubview:self.view];
    68     [container addSubview:self.view];
    69 
    69 
    70     if (placingPoint.x == -1 && placingPoint.y == -1)
    70     if (placingPoint.x == -1 || placingPoint.y == -1)
    71         placingPoint = container.center;
    71         placingPoint = container.center;
    72     if (IS_DUALHEAD() == NO)
    72     if (IS_DUALHEAD() == YES) {
    73         self.view.center = CGPointMake(placingPoint.y, placingPoint.x);
       
    74     else {
       
    75         UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
    73         UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
    76         if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight)
    74         if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight)
    77             self.view.center = CGPointMake(placingPoint.y, placingPoint.x);
    75             self.view.center = CGPointMake(placingPoint.y, placingPoint.x);
    78         else
    76         else
    79             self.view.center = CGPointMake(placingPoint.x, placingPoint.y);
    77             self.view.center = CGPointMake(placingPoint.x, placingPoint.y);
    80     }
    78     } else
       
    79         self.view.center = CGPointMake(placingPoint.y, placingPoint.x);
       
    80 
    81     self.isVisible = YES;
    81     self.isVisible = YES;
    82     if (IS_IPAD() == NO)
    82     if (IS_IPAD() == NO)
    83         HW_pause();
    83         HW_pause();
    84 }
    84 }
    85 
    85 
   114     caption.minimumFontSize = 8;
   114     caption.minimumFontSize = 8;
   115     self.captionLabel = caption;
   115     self.captionLabel = caption;
   116     [self.view addSubview:self.captionLabel];
   116     [self.view addSubview:self.captionLabel];
   117     [caption release];
   117     [caption release];
   118 
   118 
   119     UILabel *description = [[UILabel alloc] initWithFrame:CGRectMake(x+2, y+20, 415, 53)];
   119     UILabel *description = [[UILabel alloc] initWithFrame:CGRectMake(x+2, self.view.frame.size.height-50, 415, 53)];
   120     description.backgroundColor = [UIColor clearColor];
   120     description.backgroundColor = [UIColor clearColor];
   121     description.textColor = [UIColor whiteColor];
   121     description.textColor = [UIColor whiteColor];
   122     description.text = DEFAULT_DESCRIPTION;
   122     description.text = DEFAULT_DESCRIPTION;
   123     description.font = [UIFont italicSystemFontOfSize:[UIFont systemFontSize]];
   123     description.font = [UIFont italicSystemFontOfSize:[UIFont systemFontSize]];
   124     description.adjustsFontSizeToFitWidth = YES;
   124     description.adjustsFontSizeToFitWidth = YES;
   279     int y, x = 8;
   279     int y, x = 8;
   280     // display labels on top for lower buttons
   280     // display labels on top for lower buttons
   281     if (theButton.tag > 41)
   281     if (theButton.tag > 41)
   282         y = 5;
   282         y = 5;
   283     else
   283     else
   284         y = (HW_getNumberOfWeapons()/BTNS_PER_ROW)*44 + 18;
   284         y = (HW_getNumberOfWeapons()/BTNS_PER_ROW)*40;
   285 
   285 
   286     self.nameLabel.frame = CGRectMake(x, y, 200, 20);
   286     self.nameLabel.frame = CGRectMake(x, y, 200, 20);
   287     self.captionLabel.frame = CGRectMake(x+200, y, 220, 20);
   287     self.captionLabel.frame = CGRectMake(x+200, y, 220, 20);
   288     self.extraLabel.frame = CGRectMake(x+2, y+20, 415, 53);
   288     self.extraLabel.frame = CGRectMake(x+2, y+20, 415, 53);
   289 }
   289 }