22 |
22 |
23 // Release any cached data, images, etc that aren't in use. |
23 // Release any cached data, images, etc that aren't in use. |
24 } |
24 } |
25 |
25 |
26 -(void) viewDidLoad { |
26 -(void) viewDidLoad { |
|
27 self.view.alpha = 0; |
|
28 |
27 dimTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:6] |
29 dimTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:6] |
28 interval:1000 |
30 interval:1000 |
29 target:self |
31 target:self |
30 selector:@selector(dimOverlay) |
32 selector:@selector(dimOverlay) |
31 userInfo:nil |
33 userInfo:nil |
32 repeats:YES]; |
34 repeats:YES]; |
33 |
35 |
34 [[NSRunLoop currentRunLoop] addTimer:dimTimer forMode:NSDefaultRunLoopMode]; |
36 [[NSRunLoop currentRunLoop] addTimer:dimTimer forMode:NSDefaultRunLoopMode]; |
35 } |
37 } |
36 |
38 |
|
39 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { |
|
40 return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); |
|
41 } |
|
42 |
37 -(void) viewDidUnload { |
43 -(void) viewDidUnload { |
38 [dimTimer invalidate]; |
44 [dimTimer invalidate]; |
39 } |
45 } |
40 |
46 |
41 -(void) dealloc { |
47 -(void) dealloc { |
42 [dimTimer release]; |
48 [dimTimer release]; |
43 [super dealloc]; |
49 [super dealloc]; |
44 } |
50 } |
45 |
51 |
|
52 // draws the controller overlay after the sdl window has taken control |
|
53 -(void) showMenuAfterwards { |
|
54 [[SDLUIKitDelegate sharedAppDelegate].uiwindow bringSubviewToFront:self.view]; |
|
55 |
|
56 [UIView beginAnimations:@"showing overlay" context:NULL]; |
|
57 [UIView setAnimationDuration:1]; |
|
58 self.view.alpha = 1; |
|
59 [UIView commitAnimations]; |
|
60 } |
46 |
61 |
47 // dim the overlay when there's no more input for a certain amount of time |
62 // dim the overlay when there's no more input for a certain amount of time |
48 -(IBAction) buttonReleased:(id) sender { |
63 -(IBAction) buttonReleased:(id) sender { |
49 HW_allKeysUp(); |
64 HW_allKeysUp(); |
50 [dimTimer setFireDate:[NSDate dateWithTimeIntervalSinceNow:2.7]]; |
65 [dimTimer setFireDate:[NSDate dateWithTimeIntervalSinceNow:2.7]]; |