project_files/HedgewarsMobile/Classes/MapConfigViewController.m
changeset 3783 8e9daf967406
parent 3780 7c704e69242e
child 3789 c3eb56754e92
equal deleted inserted replaced
3782:dc3531e49e4c 3783:8e9daf967406
   146     UIImage *previewImage = UIGraphicsGetImageFromCurrentImageContext();
   146     UIImage *previewImage = UIGraphicsGetImageFromCurrentImageContext();
   147     UIGraphicsEndImageContext();
   147     UIGraphicsEndImageContext();
   148     */
   148     */
   149 }
   149 }
   150 
   150 
   151 -(IBAction) updatePreview {
   151 -(IBAction) mapButtonPressed {
       
   152     playSound(@"clickSound");
       
   153     [self updatePreview];
       
   154 }
       
   155 
       
   156 -(void) updatePreview {
   152     // don't generate a new preview while it's already generating one
   157     // don't generate a new preview while it's already generating one
   153     if (busy)
   158     if (busy)
   154         return;
   159         return;
   155 
   160 
   156     // generate a seed
   161     // generate a seed
   433     int num = (int) (self.slider.value * 100);
   438     int num = (int) (self.slider.value * 100);
   434     if (oldValue != num) {
   439     if (oldValue != num) {
   435         [self updatePreview];
   440         [self updatePreview];
   436         oldValue = num;
   441         oldValue = num;
   437     }
   442     }
       
   443     playSound(@"clickSound");
   438 }
   444 }
   439 
   445 
   440 // perform actions based on the activated section, then call updatePreview to visually update the selection
   446 // perform actions based on the activated section, then call updatePreview to visually update the selection
   441 // updatePreview will call didSelectRowAtIndexPath which will call the right update routine)
   447 // updatePreview will call didSelectRowAtIndexPath which will call the right update routine)
   442 // and if necessary update the table with a slide animation
   448 // and if necessary update the table with a slide animation
   443 -(IBAction) segmentedControlChanged:(id) sender {
   449 -(IBAction) segmentedControlChanged:(id) sender {
   444     NSString *mapgen, *staticmap;
   450     NSString *mapgen, *staticmap;
   445     NSInteger newPage = self.segmentedControl.selectedSegmentIndex;
   451     NSInteger newPage = self.segmentedControl.selectedSegmentIndex;
   446 
   452 
       
   453     playSound(@"selSound");
   447     switch (newPage) {
   454     switch (newPage) {
   448         case 0: // Random
   455         case 0: // Random
   449             mapgen = @"e$mapgen 0";
   456             mapgen = @"e$mapgen 0";
   450             staticmap = @"";
   457             staticmap = @"";
   451             [self sliderChanged:nil];
   458             [self sliderChanged:nil];