axmol/tests/AppDelegate.cpp

125 lines
3.7 KiB
C++
Raw Normal View History

#include "AppDelegate.h"
#include "cocos2d.h"
#include "tests/controller.h"
//#include "SimpleAudioEngine.h"
USING_NS_CC;
//using namespace CocosDenshion;
AppDelegate::AppDelegate()
{
}
AppDelegate::~AppDelegate()
{
// SimpleAudioEngine::end();
}
bool AppDelegate::initInstance()
{
bool bRet = false;
do
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The tests is designed as HVGA.
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd
|| ! pMainWnd->Create(TEXT("cocos2d: tests"), 480, 320));
#endif // CC_PLATFORM_WIN32
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// OpenGLView initialized in testsAppDelegate.mm on ios platform, nothing need to do here.
#endif // CC_PLATFORM_IOS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Android doesn't need to do anything.
#endif // CC_PLATFORM_ANDROID
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WOPHONE)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The tests is designed as HVGA.
CCEGLView* pMainWnd = new CCEGLView(this);
2011-05-06 16:38:09 +08:00
CC_BREAK_IF(! pMainWnd || ! pMainWnd->Create(320 ,480, WM_WINDOW_ROTATE_MODE_CW));
#ifndef _TRANZDA_VM_
// on wophone emulator, we copy resources files to Work7/NEWPLUS/TDA_DATA/Data folder instead of zip file
cocos2d::CCFileUtils::setResource("TestCocos2dx.zip");
CocosDenshion::SimpleAudioEngine::setResource("TestCocos2dx.zip");
#endif
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_AIRPLAY)
CCDirector::sharedDirector()->setDeviceOrientation(CCDeviceOrientationLandscapeLeft);
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The HelloWorld is designed as HVGA.
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd
modified: cocos2dx/.cproject modified: cocos2dx/CCConfiguration.cpp modified: cocos2dx/CCConfiguration.h modified: cocos2dx/actions/CCActionGrid3D.cpp modified: cocos2dx/platform/Linux/CCAplication_linux.cpp modified: cocos2dx/platform/Linux/CCAplication_linux.h modified: cocos2dx/platform/Linux/CCImage_Linux.cpp modified: mycreate-android-project.sh new file: post.sh modified: template/android/mycopy_files.sh modified: tests/AppDelegate.cpp new file: tests/test.linux/Res deleted: tests/test.linux/Res/Hello.png deleted: tests/test.linux/Res/Images/BoilingFoam.plist deleted: tests/test.linux/Res/Images/BurstPipe.plist deleted: tests/test.linux/Res/Images/Comet.plist deleted: tests/test.linux/Res/Images/Comet.png deleted: tests/test.linux/Res/Images/ExplodingRing.plist deleted: tests/test.linux/Res/Images/Flower.plist deleted: tests/test.linux/Res/Images/Fog.png deleted: tests/test.linux/Res/Images/Galaxy.plist deleted: tests/test.linux/Res/Images/HelloWorld.png deleted: tests/test.linux/Res/Images/Icon.png deleted: tests/test.linux/Res/Images/LavaFlow.plist deleted: tests/test.linux/Res/Images/Pea.png deleted: tests/test.linux/Res/Images/Phoenix.plist deleted: tests/test.linux/Res/Images/PlanetCute-1024x1024.png deleted: tests/test.linux/Res/Images/SendScoreButton.png deleted: tests/test.linux/Res/Images/SendScoreButtonPressed.png deleted: tests/test.linux/Res/Images/SpinningPeas.plist deleted: tests/test.linux/Res/Images/SpinningPeas.png deleted: tests/test.linux/Res/Images/Spiral.plist deleted: tests/test.linux/Res/Images/SpookyPeas.plist deleted: tests/test.linux/Res/Images/SpookyPeas.png deleted: tests/test.linux/Res/Images/Upsidedown.plist deleted: tests/test.linux/Res/Images/atlastest.png deleted: tests/test.linux/Res/Images/b1-hd.png deleted: tests/test.linux/Res/Images/b1.png deleted: tests/test.linux/Res/Images/b2-hd.png deleted: tests/test.linux/Res/Images/b2.png deleted: tests/test.linux/Res/Images/background.png deleted: tests/test.linux/Res/Images/background1-hd.png deleted: tests/test.linux/Res/Images/background1.png deleted: tests/test.linux/Res/Images/background2-hd.png deleted: tests/test.linux/Res/Images/background2.png deleted: tests/test.linux/Res/Images/background3-hd.png deleted: tests/test.linux/Res/Images/background3.png deleted: tests/test.linux/Res/Images/ball-hd.png deleted: tests/test.linux/Res/Images/ball.png deleted: tests/test.linux/Res/Images/bitmapFontTest3.fnt deleted: tests/test.linux/Res/Images/bitmapFontTest3.png deleted: tests/test.linux/Res/Images/blocks-hd.png deleted: tests/test.linux/Res/Images/blocks.png deleted: tests/test.linux/Res/Images/btn-about-normal.png deleted: tests/test.linux/Res/Images/btn-about-selected.png deleted: tests/test.linux/Res/Images/btn-highscores-normal.png deleted: tests/test.linux/Res/Images/btn-highscores-selected.png deleted: tests/test.linux/Res/Images/btn-play-normal.png deleted: tests/test.linux/Res/Images/btn-play-selected.png deleted: tests/test.linux/Res/Images/bugs/RetinaDisplay.jpg deleted: tests/test.linux/Res/Images/bugs/bug886.jpg deleted: tests/test.linux/Res/Images/bugs/bug886.png deleted: tests/test.linux/Res/Images/bugs/circle-hd.plist deleted: tests/test.linux/Res/Images/bugs/circle-hd.png deleted: tests/test.linux/Res/Images/bugs/circle.plist deleted: tests/test.linux/Res/Images/bugs/circle.png deleted: tests/test.linux/Res/Images/bugs/corner.png deleted: tests/test.linux/Res/Images/bugs/edge.png deleted: tests/test.linux/Res/Images/bugs/fill.png deleted: tests/test.linux/Res/Images/bugs/picture-hd.png deleted: tests/test.linux/Res/Images/bugs/picture.png deleted: tests/test.linux/Res/Images/close-hd.png deleted: tests/test.linux/Res/Images/close.png deleted: tests/test.linux/Res/Images/debian.plist deleted: tests/test.linux/Res/Images/f1-hd.png deleted: tests/test.linux/Res/Images/f1.png deleted: tests/test.linux/Res/Images/f2-hd.png deleted: tests/test.linux/Res/Images/f2.png deleted: tests/test.linux/Res/Images/fire-grayscale.png deleted: tests/test.linux/Res/Images/fire.png deleted: tests/test.linux/Res/Images/fps_images.png deleted: tests/test.linux/Res/Images/grossini-hd.png deleted: tests/test.linux/Res/Images/grossini.png deleted: tests/test.linux/Res/Images/grossini_128x256_mipmap.pvr deleted: tests/test.linux/Res/Images/grossini_dance_01.png deleted: tests/test.linux/Res/Images/grossini_dance_02.png deleted: tests/test.linux/Res/Images/grossini_dance_03.png deleted: tests/test.linux/Res/Images/grossini_dance_04.png deleted: tests/test.linux/Res/Images/grossini_dance_05.png deleted: tests/test.linux/Res/Images/grossini_dance_06.png deleted: tests/test.linux/Res/Images/grossini_dance_07.png deleted: tests/test.linux/Res/Images/grossini_dance_08.png deleted: tests/test.linux/Res/Images/grossini_dance_09.png deleted: tests/test.linux/Res/Images/grossini_dance_10.png deleted: tests/test.linux/Res/Images/grossini_dance_11.png deleted: tests/test.linux/Res/Images/grossini_dance_12.png deleted: tests/test.linux/Res/Images/grossini_dance_13.png deleted: tests/test.linux/Res/Images/grossini_dance_14.png deleted: tests/test.linux/Res/Images/grossini_dance_atlas-hd.png deleted: tests/test.linux/Res/Images/grossini_dance_atlas-mono.png deleted: tests/test.linux/Res/Images/grossini_dance_atlas.png deleted: tests/test.linux/Res/Images/grossini_dance_atlas_nomipmap.png deleted: tests/test.linux/Res/Images/grossini_pvr_rgba4444.pvr deleted: tests/test.linux/Res/Images/grossini_pvr_rgba8888.pvr deleted: tests/test.linux/Res/Images/grossinis_sister1-hd.png deleted: tests/test.linux/Res/Images/grossinis_sister1-testalpha.png deleted: tests/test.linux/Res/Images/grossinis_sister1-testalpha.ppng deleted: tests/test.linux/Res/Images/grossinis_sister1.png deleted: tests/test.linux/Res/Images/grossinis_sister2-hd.png deleted: tests/test.linux/Res/Images/grossinis_sister2.png deleted: tests/test.linux/Res/Images/landscape-1024x1024.png deleted: tests/test.linux/Res/Images/logo-mipmap.pvr deleted: tests/test.linux/Res/Images/logo-nomipmap.pvr deleted: tests/test.linux/Res/Images/menuitemsprite.png deleted: tests/test.linux/Res/Images/paddle-hd.png deleted: tests/test.linux/Res/Images/paddle.png deleted: tests/test.linux/Res/Images/particles-hd.png deleted: tests/test.linux/Res/Images/particles.png deleted: tests/test.linux/Res/Images/pattern1.png deleted: tests/test.linux/Res/Images/piece.png deleted: tests/test.linux/Res/Images/powered.png deleted: tests/test.linux/Res/Images/r1-hd.png deleted: tests/test.linux/Res/Images/r1.png deleted: tests/test.linux/Res/Images/r2-hd.png deleted: tests/test.linux/Res/Images/r2.png deleted: tests/test.linux/Res/Images/snow.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-0-0.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-0-1.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-0-2.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-0-3.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-0-4.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-0-5.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-0-6.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-0-7.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-1-0.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-1-1.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-1-2.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-1-3.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-1-4.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-1-5.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-1-6.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-1-7.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-2-0.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-2-1.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-2-2.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-2-3.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-2-4.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-2-5.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-2-6.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-2-7.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-3-0.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-3-1.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-3-2.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-3-3.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-3-4.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-3-5.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-3-6.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-3-7.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-4-0.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-4-1.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-4-2.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-4-3.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-4-4.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-4-5.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-4-6.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-4-7.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-5-0.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-5-1.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-5-2.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-5-3.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-5-4.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-5-5.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-5-6.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-5-7.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-6-0.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-6-1.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-6-2.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-6-3.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-6-4.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-6-5.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-6-6.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-6-7.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-7-0.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-7-1.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-7-2.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-7-3.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-7-4.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-7-5.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-7-6.png deleted: tests/test.linux/Res/Images/sprites_test/sprite-7-7.png deleted: tests/test.linux/Res/Images/spritesheet1.png deleted: tests/test.linux/Res/Images/stars-grayscale.png deleted: tests/test.linux/Res/Images/stars.png deleted: tests/test.linux/Res/Images/stars2-grayscale.png deleted: tests/test.linux/Res/Images/stars2.png deleted: tests/test.linux/Res/Images/streak.png deleted: tests/test.linux/Res/Images/test-rgba1.png deleted: tests/test.linux/Res/Images/test_blend.png deleted: tests/test.linux/Res/Images/test_image-bad_encoding.pvr deleted: tests/test.linux/Res/Images/test_image.jpeg deleted: tests/test.linux/Res/Images/test_image.png deleted: tests/test.linux/Res/Images/test_image.pvr deleted: tests/test.linux/Res/Images/test_image.pvrraw deleted: tests/test.linux/Res/Images/test_image_a8.pvr deleted: tests/test.linux/Res/Images/test_image_ai88.pvr deleted: tests/test.linux/Res/Images/test_image_bgra8888.pvr deleted: tests/test.linux/Res/Images/test_image_i8.pvr deleted: tests/test.linux/Res/Images/test_image_pvrtc2bpp.pvr deleted: tests/test.linux/Res/Images/test_image_pvrtc4bpp.pvr deleted: tests/test.linux/Res/Images/test_image_rgb565.pvr deleted: tests/test.linux/Res/Images/test_image_rgba4444.pvr deleted: tests/test.linux/Res/Images/test_image_rgba4444.pvr.ccz deleted: tests/test.linux/Res/Images/test_image_rgba4444.pvr.gz deleted: tests/test.linux/Res/Images/test_image_rgba4444_mipmap.pvr deleted: tests/test.linux/Res/Images/test_image_rgba5551.pvr deleted: tests/test.linux/Res/Images/test_image_rgba8888.pvr deleted: tests/test.linux/Res/Images/texture1024x1024.png deleted: tests/test.linux/Res/Images/texture2048x2048.png deleted: tests/test.linux/Res/Images/texture512x512.png deleted: tests/test.linux/Res/TileMaps/fixed-ortho-test2.png deleted: tests/test.linux/Res/TileMaps/hexa-test.tmx deleted: tests/test.linux/Res/TileMaps/hexa-tiles.png deleted: tests/test.linux/Res/TileMaps/iso-test-bug787.tmx deleted: tests/test.linux/Res/TileMaps/iso-test-movelayer.tmx deleted: tests/test.linux/Res/TileMaps/iso-test-objectgroup.tmx deleted: tests/test.linux/Res/TileMaps/iso-test-vertexz.tmx deleted: tests/test.linux/Res/TileMaps/iso-test-zorder.tmx deleted: tests/test.linux/Res/TileMaps/iso-test.png deleted: tests/test.linux/Res/TileMaps/iso-test.tmx deleted: tests/test.linux/Res/TileMaps/iso-test1.tmx deleted: tests/test.linux/Res/TileMaps/iso-test2-uncompressed.tmx deleted: tests/test.linux/Res/TileMaps/iso-test2.png deleted: tests/test.linux/Res/TileMaps/iso-test2.tmx deleted: tests/test.linux/Res/TileMaps/iso.png deleted: tests/test.linux/Res/TileMaps/levelmap.tga deleted: tests/test.linux/Res/TileMaps/ortho-objects.tmx deleted: tests/test.linux/Res/TileMaps/ortho-test1.png deleted: tests/test.linux/Res/TileMaps/ortho-test1_bw.png deleted: tests/test.linux/Res/TileMaps/ortho-test2.png deleted: tests/test.linux/Res/TileMaps/orthogonal-test-movelayer.tmx deleted: tests/test.linux/Res/TileMaps/orthogonal-test-vertexz.tmx deleted: tests/test.linux/Res/TileMaps/orthogonal-test-zorder.tmx deleted: tests/test.linux/Res/TileMaps/orthogonal-test1.tmx deleted: tests/test.linux/Res/TileMaps/orthogonal-test1.tsx deleted: tests/test.linux/Res/TileMaps/orthogonal-test2.tmx deleted: tests/test.linux/Res/TileMaps/orthogonal-test3.tmx deleted: tests/test.linux/Res/TileMaps/orthogonal-test4-hd.tmx deleted: tests/test.linux/Res/TileMaps/orthogonal-test4.tmx deleted: tests/test.linux/Res/TileMaps/orthogonal-test5.tmx deleted: tests/test.linux/Res/TileMaps/orthogonal-test6-hd.tmx deleted: tests/test.linux/Res/TileMaps/orthogonal-test6.tmx deleted: tests/test.linux/Res/TileMaps/test-object-layer.tmx deleted: tests/test.linux/Res/TileMaps/tiles-hd.png deleted: tests/test.linux/Res/TileMaps/tiles.png deleted: tests/test.linux/Res/TileMaps/tmw_desert_spacing-hd.png deleted: tests/test.linux/Res/TileMaps/tmw_desert_spacing.png deleted: tests/test.linux/Res/animations/dragon_animation-hd.png deleted: tests/test.linux/Res/animations/dragon_animation.png deleted: tests/test.linux/Res/animations/ghosts.plist deleted: tests/test.linux/Res/animations/ghosts.png deleted: tests/test.linux/Res/animations/grossini-aliases.plist deleted: tests/test.linux/Res/animations/grossini-aliases.png deleted: tests/test.linux/Res/animations/grossini.plist deleted: tests/test.linux/Res/animations/grossini.plist.xml deleted: tests/test.linux/Res/animations/grossini.png deleted: tests/test.linux/Res/animations/grossini.ztp deleted: tests/test.linux/Res/animations/grossini_blue.plist deleted: tests/test.linux/Res/animations/grossini_blue.png deleted: tests/test.linux/Res/animations/grossini_family.plist deleted: tests/test.linux/Res/animations/grossini_family.png deleted: tests/test.linux/Res/animations/grossini_gray.plist deleted: tests/test.linux/Res/animations/grossini_gray.png deleted: tests/test.linux/Res/app.config.txt deleted: tests/test.linux/Res/background.mp3 deleted: tests/test.linux/Res/effect1.wav deleted: tests/test.linux/Res/effect2.ogg deleted: tests/test.linux/Res/fonts/A Damn Mess.ttf deleted: tests/test.linux/Res/fonts/Abberancy.ttf deleted: tests/test.linux/Res/fonts/Abduction.ttf deleted: tests/test.linux/Res/fonts/Paint Boy.ttf deleted: tests/test.linux/Res/fonts/Schwarzwald Regular.ttf deleted: tests/test.linux/Res/fonts/Scissor Cuts.ttf deleted: tests/test.linux/Res/fonts/arial16.fnt deleted: tests/test.linux/Res/fonts/arial16.png deleted: tests/test.linux/Res/fonts/bitmapFontTest.fnt deleted: tests/test.linux/Res/fonts/bitmapFontTest.png deleted: tests/test.linux/Res/fonts/bitmapFontTest2.fnt deleted: tests/test.linux/Res/fonts/bitmapFontTest2.png deleted: tests/test.linux/Res/fonts/bitmapFontTest3.fnt deleted: tests/test.linux/Res/fonts/bitmapFontTest3.png deleted: tests/test.linux/Res/fonts/bitmapFontTest4.fnt deleted: tests/test.linux/Res/fonts/bitmapFontTest4.png deleted: tests/test.linux/Res/fonts/bitmapFontTest5.fnt deleted: tests/test.linux/Res/fonts/bitmapFontTest5.png deleted: tests/test.linux/Res/fonts/fps_images-hd.png deleted: tests/test.linux/Res/fonts/fps_images.png deleted: tests/test.linux/Res/fonts/futura-48.fnt deleted: tests/test.linux/Res/fonts/futura-48.png deleted: tests/test.linux/Res/fonts/konqa32-hd.fnt deleted: tests/test.linux/Res/fonts/konqa32-hd.png deleted: tests/test.linux/Res/fonts/konqa32.fnt deleted: tests/test.linux/Res/fonts/konqa32.png deleted: tests/test.linux/Res/fonts/larabie-16-hd.png deleted: tests/test.linux/Res/fonts/larabie-16.png deleted: tests/test.linux/Res/fonts/tuffy_bold_italic-charmap-hd.png deleted: tests/test.linux/Res/fonts/tuffy_bold_italic-charmap.png deleted: tests/test.linux/Res/music.mid deleted: tests/test.linux/Res/zwoptex/grossini-generic.plist deleted: tests/test.linux/Res/zwoptex/grossini-generic.png deleted: tests/test.linux/Res/zwoptex/grossini.plist deleted: tests/test.linux/Res/zwoptex/grossini.png CocosDenshion/AndroidDebug/ CocosDenshion/AndroidRelease/ HelloCocos2dx/AndroidDebug/2 HelloCocos2dx/android/assets HelloCocos2dx/postCompiled.sh installLinuxLib.sh
2011-08-23 11:28:04 +08:00
|| ! pMainWnd->Create("cocos2d: tests", 480, 320, 480, 320));
//set the base resource folder pay attention to add "/"
2011-09-16 10:23:57 +08:00
CCFileUtils::setResourcePath("../Res/");
#endif // CC_PLATFORM_LINUX
bRet = true;
} while (0);
return bRet;
}
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
// pDirector->enableRetinaDisplay(true);
// sets opengl landscape mode
// tests set device orientation in RootViewController.mm
// pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
// turn on display FPS
2011-08-19 15:37:57 +08:00
pDirector->setDisplayFPS(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
CCScene * pScene = CCScene::node();
CCLayer * pLayer = new TestController();
pLayer->autorelease();
pScene->addChild(pLayer);
pDirector->runWithScene(pScene);
return true;
}
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground()
{
CCDirector::sharedDirector()->pause();
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
CCDirector::sharedDirector()->resume();
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
}