diff --git a/CHANGELOG b/CHANGELOG index d8e824c6f1..f99dabfa15 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +cocos2d-x-3.0rc0 Feb.??? 2014 +[All] + [FIX] EGLView improvements: renamed to GLView, no longer a singleton, easier to customize + cocos2d-x-3.0beta2 Jan.24 2014 [All] [NEW] Full screen support for desktop platforms. diff --git a/samples/Cpp/HelloCpp/Classes/AppDelegate.cpp b/samples/Cpp/HelloCpp/Classes/AppDelegate.cpp index 04961ee215..8e60f85a71 100644 --- a/samples/Cpp/HelloCpp/Classes/AppDelegate.cpp +++ b/samples/Cpp/HelloCpp/Classes/AppDelegate.cpp @@ -17,12 +17,15 @@ AppDelegate::~AppDelegate() { } -bool AppDelegate::applicationDidFinishLaunching() { +bool AppDelegate::applicationDidFinishLaunching() +{ // initialize director auto director = Director::getInstance(); - auto glview = EGLView::createWithSize("Hello Cpp", Size(900,640)); - - director->setOpenGLView(glview); + auto glview = director->getOpenGLView(); + if(!glview) { + auto glview = EGLView::createWithSize("Hello Cpp", Size(480, 720)); + director->setOpenGLView(glview); + } // Set the design resolution glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER); diff --git a/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp b/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp index ba500209f3..e2e77e680e 100644 --- a/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp +++ b/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp @@ -12,13 +12,15 @@ AppDelegate::~AppDelegate() { } -bool AppDelegate::applicationDidFinishLaunching() { - // initialize director +bool AppDelegate::applicationDidFinishLaunching() +{ auto director = Director::getInstance(); - auto glview = EGLView::createWithSize("Simple Game", Size(900,640)); + auto glview = director->getOpenGLView(); + if(!glview) { + glview = EGLView::createWithSize("Simple Game", Size(900,640)); + director->setOpenGLView(glview); + } - director->setOpenGLView(glview); - auto screenSize = glview->getFrameSize(); auto designSize = Size(480, 320); std::vector searchPaths; diff --git a/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp b/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp index d738d1121d..bb578d8a86 100644 --- a/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp +++ b/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp @@ -33,8 +33,12 @@ bool AppDelegate::applicationDidFinishLaunching() { // initialize director auto director = Director::getInstance(); - auto glview = EGLView::createWithSize("CocosDragon JS", Size(480, 720)); - director->setOpenGLView(glview); + auto glview = director->getOpenGLView(); + if(!glview) { + auto glview = EGLView::createWithSize("CocosDragon JS", Size(480, 720)); + director->setOpenGLView(glview); + } + director->setProjection(Director::Projection::_2D); diff --git a/samples/Javascript/CrystalCraze/Classes/AppDelegate.cpp b/samples/Javascript/CrystalCraze/Classes/AppDelegate.cpp index 23f534b9d4..78b9725085 100644 --- a/samples/Javascript/CrystalCraze/Classes/AppDelegate.cpp +++ b/samples/Javascript/CrystalCraze/Classes/AppDelegate.cpp @@ -29,9 +29,12 @@ bool AppDelegate::applicationDidFinishLaunching() { // initialize director auto director = Director::getInstance(); - auto glview = EGLView::createWithSize("Crystal Craze", Size(480, 720)); + auto glview = director->getOpenGLView(); + if(!glview) { + auto glview = EGLView::createWithSize("Crystal Craze", Size(480, 720)); + director->setOpenGLView(glview); + } - director->setOpenGLView(glview); director->setProjection(Director::Projection::_2D); FileUtils::getInstance()->addSearchPath("script"); diff --git a/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp b/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp index 8fd1e2ed4c..0f32e07fc0 100644 --- a/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp +++ b/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp @@ -29,9 +29,12 @@ bool AppDelegate::applicationDidFinishLaunching() { // initialize director auto director = Director::getInstance(); - auto glview = EGLView::createWithSize("Moon Warriors", Size(480, 720)); + auto glview = director->getOpenGLView(); + if(!glview) { + auto glview = EGLView::createWithSize("Moon Warriors", Size(480, 720)); + director->setOpenGLView(glview); + } - director->setOpenGLView(glview); director->setProjection(Director::Projection::_2D); // Set the design resolution diff --git a/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp b/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp index 263c4184ee..e8895d9769 100644 --- a/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp +++ b/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp @@ -38,9 +38,11 @@ bool AppDelegate::applicationDidFinishLaunching() { // initialize director auto director = Director::getInstance(); - auto glview = EGLView::createWithSize("Test JavaScript", Size(900,640)); - - director->setOpenGLView(glview); + auto glview = director->getOpenGLView(); + if(!glview) { + glview = EGLView::createWithSize("Test JavaScript", Size(900,640)); + director->setOpenGLView(glview); + } // JS-Test in Html5 uses 800x450 as design resolution glview->setDesignResolutionSize(800, 450, ResolutionPolicy::FIXED_HEIGHT); diff --git a/samples/Javascript/WatermelonWithMe/Classes/AppDelegate.cpp b/samples/Javascript/WatermelonWithMe/Classes/AppDelegate.cpp index 081a7eb64c..d65e0ba31d 100644 --- a/samples/Javascript/WatermelonWithMe/Classes/AppDelegate.cpp +++ b/samples/Javascript/WatermelonWithMe/Classes/AppDelegate.cpp @@ -29,9 +29,12 @@ bool AppDelegate::applicationDidFinishLaunching() { // initialize director auto director = Director::getInstance(); - auto glview = EGLView::createWithSize("Watermelon With Me", Size(900,640)); - director->setOpenGLView(glview); - + auto glview = director->getOpenGLView(); + if(!glview) { + auto glview = EGLView::createWithSize("Watermelon With Me", Size(900,640)); + director->setOpenGLView(glview); + } + // turn on display FPS director->setDisplayStats(true); diff --git a/samples/Lua/HelloLua/Classes/AppDelegate.cpp b/samples/Lua/HelloLua/Classes/AppDelegate.cpp index bc667f3f62..542548583b 100644 --- a/samples/Lua/HelloLua/Classes/AppDelegate.cpp +++ b/samples/Lua/HelloLua/Classes/AppDelegate.cpp @@ -24,9 +24,11 @@ bool AppDelegate::applicationDidFinishLaunching() { // initialize director auto director = Director::getInstance(); - auto glview = EGLView::createWithSize("Hello Lua", Size(900,640)); - - director->setOpenGLView(glview); + auto glview = director->getOpenGLView(); + if(!glview) { + auto glview = EGLView::createWithSize("Hello Lua", Size(900,640)); + director->setOpenGLView(glview); + } glview->setDesignResolutionSize(480, 320, ResolutionPolicy::NO_BORDER); diff --git a/samples/Lua/TestLua/Classes/AppDelegate.cpp b/samples/Lua/TestLua/Classes/AppDelegate.cpp index 31329bb48d..5c9066407a 100644 --- a/samples/Lua/TestLua/Classes/AppDelegate.cpp +++ b/samples/Lua/TestLua/Classes/AppDelegate.cpp @@ -19,11 +19,12 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { - // initialize director auto director = Director::getInstance(); - auto glview = EGLView::createWithSize("Test Lua", Size(900,640)); - - director->setOpenGLView(glview); + auto glview = director->getOpenGLView(); + if(!glview) { + glview = EGLView::createWithSize("Test Lua", Size(900,640)); + director->setOpenGLView(glview); + } // turn on display FPS director->setDisplayStats(true);