//
// AppDelegate.mm
// iphone-gl-app
//
// Created by John Ryland on 7/06/09.
// Copyright InvertedLogic 2009. All rights reserved.
//
#import "AppDelegate.h"
#import "GraphicsView.h"
#import "Debug.h"
@implementation AppDelegate
- (void) applicationDidFinishLaunching:(UIApplication *)application
{
DebugMemory::enable();
DebugMessage::debug("Created - Debug enabled\n");
CGRect rect = [[UIScreen mainScreen] applicationFrame];
//Create a full-screen window
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[window setBackgroundColor:[UIColor blackColor]];
//Create the OpenGL drawing view and add it to the window
view = [[GraphicsView alloc] initWithFrame:CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height)];
[window addSubview:view];
//Show the window
[window makeKeyAndVisible];
}
- (void) applicationWillResignActive:(UIApplication *)application
{
[view setAnimationInterval:(1.0 / 5.0)];
}
- (void) applicationDidBecomeActive:(UIApplication *)application
{
[view setAnimationInterval:(1.0 / 30.0)];
}
-(void) applicationWillTerminate:(UIApplication *)application
{
DebugMessage::debug("XXXXX\n");
[window release];
[view dealloc];
DebugMemory::disable();
//DebugMemory::showMemoryLeaks();
DebugMemory::showLocatableMemoryLeaks();
DebugMemory::showMemoryAllocations();
DebugMessage::debug("YYYYY\n");
}
- (void) dealloc
{
[window release];
[view release];
[super dealloc];
}
@end