126 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
126 SDL_VideoDevice *_this = SDL_GetVideoDevice(); |
127 SDL_VideoDisplay *display = &_this->displays[0]; |
127 SDL_VideoDisplay *display = &_this->displays[0]; |
128 sdlwindow = display->windows; |
128 sdlwindow = display->windows; |
129 } |
129 } |
130 |
130 |
131 /* these are causing problems at reloading so let's remove 'em |
|
132 -(void) viewDidUnload { |
131 -(void) viewDidUnload { |
133 [dimTimer invalidate]; |
132 // only object initialized in viewDidLoad should be here |
134 self.popoverController = nil; |
133 dimTimer = nil; |
135 self.popupMenu = nil; |
134 MSG_DIDUNLOAD(); |
136 [super viewDidUnload]; |
135 [super viewDidUnload]; |
137 MSG_DIDUNLOAD(); |
|
138 } |
136 } |
139 |
137 |
140 -(void) didReceiveMemoryWarning { |
138 -(void) didReceiveMemoryWarning { |
141 // Releases the view if it doesn't have a superview. |
139 // Releases the view if it doesn't have a superview. |
142 [super didReceiveMemoryWarning]; |
140 [super didReceiveMemoryWarning]; |
143 // Release any cached data, images, etc that aren't in use. |
141 // Release any cached data, images, etc that aren't in use. |
144 if (popupMenu.view.superview == nil) |
142 if (popupMenu.view.superview == nil) |
145 popupMenu = nil; |
143 popupMenu = nil; |
146 MSG_MEMCLEAN(); |
144 MSG_MEMCLEAN(); |
147 } |
145 } |
148 */ |
146 |
149 |
147 |
150 -(void) dealloc { |
148 -(void) dealloc { |
151 [popupMenu release]; |
149 [popupMenu release]; |
152 [popoverController release]; |
150 [popoverController release]; |
153 // dimTimer is autoreleased |
151 // dimTimer is autoreleased |
446 } |
444 } |
447 |
445 |
448 -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { |
446 -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { |
449 CGRect screen = [[UIScreen mainScreen] bounds]; |
447 CGRect screen = [[UIScreen mainScreen] bounds]; |
450 NSSet *allTouches = [event allTouches]; |
448 NSSet *allTouches = [event allTouches]; |
451 int x, y; |
449 int x, y, dx, dy; |
452 |
450 |
453 UITouch *touch, *first, *second; |
451 UITouch *touch, *first, *second; |
454 |
452 |
455 switch ([allTouches count]) { |
453 switch ([allTouches count]) { |
456 case 1: |
454 case 1: |
460 if (HW_isAmmoOpen() || HW_isWeaponRequiringClick()) { |
458 if (HW_isAmmoOpen() || HW_isWeaponRequiringClick()) { |
461 // moves the cursor around |
459 // moves the cursor around |
462 HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y)); |
460 HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y)); |
463 } else { |
461 } else { |
464 // panning \o/ |
462 // panning \o/ |
|
463 dx = startingPoint.x - currentPosition.x; |
|
464 dy = currentPosition.y - startingPoint.y; |
465 HW_getCursor(&x, &y); |
465 HW_getCursor(&x, &y); |
466 x = x + currentPosition.x - startingPoint.x; |
466 // momentum (or something like that) |
467 y = y + currentPosition.y - startingPoint.y; |
467 if (abs(dx) > 40) dx *= log(abs(dx)/4); |
468 HW_setCursor(x, y); |
468 if (abs(dy) > 40) dy *= log(abs(dy)/4); |
469 |
469 HW_setCursor(x + dx, y + dy); |
470 startingPoint = currentPosition; |
470 startingPoint = currentPosition; |
471 } |
471 } |
472 break; |
472 break; |
473 case 2: |
473 case 2: |
474 first = [[allTouches allObjects] objectAtIndex:0]; |
474 first = [[allTouches allObjects] objectAtIndex:0]; |