equal
deleted
inserted
replaced
86 |
86 |
87 // select the port for IPC and launch the preview generation |
87 // select the port for IPC and launch the preview generation |
88 int port = randomPort(); |
88 int port = randomPort(); |
89 pthread_t thread_id; |
89 pthread_t thread_id; |
90 pthread_create(&thread_id, NULL, (void *)GenLandPreview, (void *)port); |
90 pthread_create(&thread_id, NULL, (void *)GenLandPreview, (void *)port); |
|
91 pthread_detach(thread_id); |
91 [self engineProtocol:port]; |
92 [self engineProtocol:port]; |
92 |
93 |
93 // draw the buffer (1 pixel per component, 0= transparent 1= color) |
94 // draw the buffer (1 pixel per component, 0= transparent 1= color) |
94 int xc = 0; |
95 int xc = 0; |
95 int yc = -1; |
96 int yc = -1; |
126 UIActivityIndicatorView *indicator = (UIActivityIndicatorView *)[self.previewButton viewWithTag:INDICATOR_TAG]; |
127 UIActivityIndicatorView *indicator = (UIActivityIndicatorView *)[self.previewButton viewWithTag:INDICATOR_TAG]; |
127 [indicator stopAnimating]; |
128 [indicator stopAnimating]; |
128 [indicator removeFromSuperview]; |
129 [indicator removeFromSuperview]; |
129 |
130 |
130 [pool release]; |
131 [pool release]; |
131 [NSThread exit]; |
132 //Invoking this method should be avoided as it does not give your thread a chance to clean up any resources it allocated during its execution. |
|
133 //[NSThread exit]; |
132 |
134 |
133 /* |
135 /* |
134 // http://developer.apple.com/mac/library/qa/qa2001/qa1037.html |
136 // http://developer.apple.com/mac/library/qa/qa2001/qa1037.html |
135 CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceGray(); |
137 CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceGray(); |
136 CGContextRef bitmapImage = CGBitmapContextCreate(mapExp, 128, 32, 8, 128, colorspace, kCGImageAlphaNone); |
138 CGContextRef bitmapImage = CGBitmapContextCreate(mapExp, 128, 32, 8, 128, colorspace, kCGImageAlphaNone); |
358 } |
360 } |
359 templateCommand = @"e$template_filter 0"; |
361 templateCommand = @"e$template_filter 0"; |
360 mazeCommand = @"e$maze_size 0"; |
362 mazeCommand = @"e$maze_size 0"; |
361 break; |
363 break; |
362 default: |
364 default: |
|
365 labelText = nil; |
|
366 templateCommand = nil; |
|
367 mazeCommand = nil; |
363 break; |
368 break; |
364 } |
369 } |
365 |
370 |
366 self.sizeLabel.text = labelText; |
371 self.sizeLabel.text = labelText; |
367 self.templateFilterCommand = templateCommand; |
372 self.templateFilterCommand = templateCommand; |
399 |
404 |
400 case 2: // Maze |
405 case 2: // Maze |
401 mapgen = @"e$mapgen 1"; |
406 mapgen = @"e$mapgen 1"; |
402 [self sliderChanged:nil]; |
407 [self sliderChanged:nil]; |
403 self.slider.enabled = YES; |
408 self.slider.enabled = YES; |
|
409 break; |
|
410 |
|
411 default: |
|
412 mapgen = nil; |
404 break; |
413 break; |
405 } |
414 } |
406 self.mapGenCommand = mapgen; |
415 self.mapGenCommand = mapgen; |
407 [self updatePreview]; |
416 [self updatePreview]; |
408 |
417 |