Skip to content

Instantly share code, notes, and snippets.

@probablycorey
Created March 30, 2010 01:16
Show Gist options
  • Select an option

  • Save probablycorey/348641 to your computer and use it in GitHub Desktop.

Select an option

Save probablycorey/348641 to your computer and use it in GitHub Desktop.
require "controllers.Menu"
waxClass{"AppDelegate", protocols = {"UIApplicationDelegate"}}
function applicationDidFinishLaunching(self, application)
math.randomseed(os.time() * os.clock()) -- Randomize Random!
self.window = UIWindow:initWithFrame(UIScreen:mainScreen():bounds())
-- cocos2d will inherit these values
self.window:setUserInteractionEnabled(true)
self.window:setMultipleTouchEnabled(true)
CCDirector:setDirectorType(CCDirectorTypeDisplayLink)
-- For 3D Effects
-- CCDirector:sharedDirector():setDepthBufferFormat(kDepthBuffer16)
-- Use RGBA_8888 buffers. Default is: RGB_565 buffers
CCDirector:sharedDirector():setPixelFormat(kPixelFormatRGBA8888)
CCTexture2D:setDefaultAlphaPixelFormat(kTexture2DPixelFormat_RGBA8888)
CCDirector:sharedDirector():setDeviceOrientation(CCDeviceOrientationPortrait)
CCDirector:sharedDirector():setAnimationInterval(1.0/60)
--CCDirector:sharedDirector():setDisplayFPS(true)
-- create an openGL view inside a window
CCDirector:sharedDirector():attachInView(self.window)
CCDirector:sharedDirector():runWithScene(Menu:scene())
self.window:makeKeyAndVisible()
end
function applicationWillResignActive(self, application)
CCDirector:sharedDirector():pause()
end
function applicationDidBecomeActive(self, application)
CCDirector:sharedDirector():resume()
end
function applicationDidReceiveMemoryWarning(self, application)
CCTextureCache:sharedTextureCache():removeUnusedTextures()
end
function applicationWillTerminate(self, application)
CCDirector:sharedDirector()["end"]() -- end is a keyword in lua, so we have to fake it out
end
function applicationSignificantTimeChange(self, application)
CCDirector:sharedDirector():setNextDeltaTimeZero(true)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment