What I'm attempting to do is create a custom UIViewController that I can use to capture and handle touch/movement events instead of relying on OIS (as has been advised in the forums), and I've looked at the following tutorials to learn about touch events:
http://www.iphonesdkarticles.com/2008/0 ... orial.html (1)
http://chris-software.com/index.php/200 ... matically/ (2)
What I've managed to do so far (in a NON-Ogre project) is create a new UIViewController programatically (link 2) and detect the events and output particulars (for debug) to the console (link 1). I've implemented the very basic code into my Ogre app (based on the iPhone templates), and the new view is created (it's set to be yellow for now so that I can see it; it'll be set to transparent later), but no matter where I create it in the AppDelegate's appDidFinishLaunching method, Ogre always renders over the top and my touch events aren't detected.
What I'm needing to know is where/how should I be creating the new subView so that it'll detect touch events on top of Ogre's rendering view, and/or is there a way I can pump through the touch events to all the views?
InputViewController.h
Code: Select all
#import <UIKit/UIKit.h>
@interface InputViewController : UIViewController
{}
@end
InputViewController.m
Code: Select all
#import "InputViewController.h"
@implementation InputViewController
-(void)loadView
{
NSLog(@"Test Load View");
self.view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
self.view.backgroundColor = [UIColor yellowColor];
[self.view release];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"Test touch-began");
}
main.cpp, in AppDelegate declaration and implementation
Code: Select all
@interface AkuEngineAppDelegate : NSObject <UIApplicationDelegate>
{
UIWindow *window;
InputViewController *inputController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
- (void)go;
@end
~~~~~~~~~~~~~~~~~~~~
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
[[UIApplication sharedApplication] setStatusBarHidden:YES]; // Hide the status bar
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Create a window
inputController = [InputViewController alloc]; // My code
[window addSubview:inputController.view]; // My code
[window makeKeyAndVisible]; // Display our window
[NSThread detachNewThreadSelector:@selector(go) toTarget:self withObject:nil];
}