equal
deleted
inserted
replaced
20 |
20 |
21 |
21 |
22 #import "MapPreviewButtonView.h" |
22 #import "MapPreviewButtonView.h" |
23 #import "MapConfigViewController.h" |
23 #import "MapConfigViewController.h" |
24 #import "UIImageExtra.h" |
24 #import "UIImageExtra.h" |
|
25 #import "ServerSetup.h" |
25 #import <pthread.h> |
26 #import <pthread.h> |
26 |
27 |
27 #define INDICATOR_TAG 7654 |
28 #define INDICATOR_TAG 7654 |
28 |
29 |
29 @implementation MapPreviewButtonView |
30 @implementation MapPreviewButtonView |
76 |
77 |
77 -(const uint8_t *)engineProtocol { |
78 -(const uint8_t *)engineProtocol { |
78 IPaddress ip; |
79 IPaddress ip; |
79 BOOL serverQuit = NO; |
80 BOOL serverQuit = NO; |
80 static uint8_t map[128*32]; |
81 static uint8_t map[128*32]; |
81 int port = randomPort(); |
82 int port = [ServerSetup randomPort]; |
82 |
83 |
83 if (SDLNet_Init() < 0) { |
84 if (SDLNet_Init() < 0) { |
84 DLog(@"SDLNet_Init: %s", SDLNet_GetError()); |
85 DLog(@"SDLNet_Init: %s", SDLNet_GetError()); |
85 serverQuit = YES; |
86 serverQuit = YES; |
86 } |
87 } |
195 // remove the current preview and title |
196 // remove the current preview and title |
196 [self setImage:nil forState:UIControlStateNormal]; |
197 [self setImage:nil forState:UIControlStateNormal]; |
197 [self setTitle:nil forState:UIControlStateNormal]; |
198 [self setTitle:nil forState:UIControlStateNormal]; |
198 |
199 |
199 // don't display preview on slower device, too slow and memory hog |
200 // don't display preview on slower device, too slow and memory hog |
200 if (IS_NOT_POWERFUL(getModelType())) { |
201 if (IS_NOT_POWERFUL([HWUtils modelType])) { |
201 [self setTitle:NSLocalizedString(@"Preview not available",@"") forState:UIControlStateNormal]; |
202 [self setTitle:NSLocalizedString(@"Preview not available",@"") forState:UIControlStateNormal]; |
202 [self turnOnWidgets]; |
203 [self turnOnWidgets]; |
203 } else { |
204 } else { |
204 // add a very nice spinning wheel |
205 // add a very nice spinning wheel |
205 UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] |
206 UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] |