diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id b/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id index 93c759b563..a2c0fb4ba8 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -e706fcdbf8b76069d794bc03e3849a57932cdf0a \ No newline at end of file +72b2e67ce3473ec4d8adf2412a9ce1d9390e0882 \ No newline at end of file diff --git a/cocos/2d/CCDirector.cpp b/cocos/2d/CCDirector.cpp index c45e10851e..d4c816091d 100644 --- a/cocos/2d/CCDirector.cpp +++ b/cocos/2d/CCDirector.cpp @@ -376,9 +376,10 @@ void Director::setOpenGLView(EGLView *openGLView) conf->gatherGPUInfo(); CCLOG("%s\n",conf->getInfo().c_str()); - // EAGLView is not a Object - delete _openGLView; // [openGLView_ release] + if(_openGLView) + _openGLView->release(); _openGLView = openGLView; + _openGLView->retain(); // set size _winSizeInPoints = _openGLView->getDesignResolutionSize(); @@ -941,7 +942,8 @@ void Director::createStatsLabel() Secondly, the size of this image is 480*320, to display the FPS label with correct size, a factor of design resolution ratio of 480x320 is also needed. */ - float factor = EGLView::getInstance()->getDesignResolutionSize().height / 320.0f; + auto glview = Director::getInstance()->getOpenGLView(); + float factor = glview->getDesignResolutionSize().height / 320.0f; _FPSLabel = LabelAtlas::create(); _FPSLabel->retain(); diff --git a/cocos/2d/platform/CCApplicationProtocol.h b/cocos/2d/platform/CCApplicationProtocol.h index 9042c649d0..016fb4b988 100644 --- a/cocos/2d/platform/CCApplicationProtocol.h +++ b/cocos/2d/platform/CCApplicationProtocol.h @@ -33,6 +33,8 @@ NS_CC_BEGIN * @{ */ +class EAGLView; + class CC_DLL ApplicationProtocol { public: diff --git a/cocos/2d/platform/CCEGLViewProtocol.cpp b/cocos/2d/platform/CCEGLViewProtocol.cpp index f494ddf44d..a31b5f514e 100644 --- a/cocos/2d/platform/CCEGLViewProtocol.cpp +++ b/cocos/2d/platform/CCEGLViewProtocol.cpp @@ -131,9 +131,10 @@ void EGLViewProtocol::setDesignResolutionSize(float width, float height, Resolut _resolutionPolicy = resolutionPolicy; // reset director's member variables to fit visible rect - Director::getInstance()->_winSizeInPoints = getDesignResolutionSize(); - Director::getInstance()->createStatsLabel(); - Director::getInstance()->setGLDefaultValues(); + auto director = Director::getInstance(); + director->_winSizeInPoints = getDesignResolutionSize(); + director->createStatsLabel(); + director->setGLDefaultValues(); } const Size& EGLViewProtocol::getDesignResolutionSize() const diff --git a/cocos/2d/platform/android/CCEGLView.cpp b/cocos/2d/platform/android/CCEGLView.cpp index e7da477e4e..ae75849f8a 100644 --- a/cocos/2d/platform/android/CCEGLView.cpp +++ b/cocos/2d/platform/android/CCEGLView.cpp @@ -48,6 +48,39 @@ void initExtensions() { NS_CC_BEGIN +EGLView* EGLView::createWithSize(const std::string& viewName, Size size, float frameZoomFactor) +{ + auto ret = new EGLView; + if(ret && ret->initWithSize(viewName, size, frameZoomFactor)) { + ret->autorelease(); + return ret; + } + + return nullptr; +} + +EGLView* EGLView::create(const std::string& viewName) +{ + auto ret = new EGLView; + if(ret && ret->initWithSize(viewName, Size(0,0), 0)) { + ret->autorelease(); + return ret; + } + + return nullptr; +} + +EGLView* EGLView::createWithFullScreen(const std::string& viewName) +{ + auto ret = new EGLView(); + if(ret && ret->initWithFullScreen(viewName)) { + ret->autorelease(); + return ret; + } + + return nullptr; +} + EGLView::EGLView() { initExtensions(); @@ -58,6 +91,17 @@ EGLView::~EGLView() } +bool EGLView::initWithSize(const std::string& viewName, Size size, float frameZoomFactor) +{ + return true; +} + +bool EGLView::initWithFullScreen(const std::string& viewName) +{ + return true; +} + + bool EGLView::isOpenGLReady() { return (_screenSize.width != 0 && _screenSize.height != 0); @@ -72,18 +116,6 @@ void EGLView::swapBuffers() { } -EGLView* EGLView::getInstance() -{ - static EGLView instance; - return &instance; -} - -// XXX: deprecated -EGLView* EGLView::sharedOpenGLView() -{ - return EGLView::getInstance(); -} - void EGLView::setIMEKeyboardState(bool bOpen) { setKeyboardStateJNI((int)bOpen); diff --git a/cocos/2d/platform/android/CCEGLView.h b/cocos/2d/platform/android/CCEGLView.h index dabb0a968d..097ae062c1 100644 --- a/cocos/2d/platform/android/CCEGLView.h +++ b/cocos/2d/platform/android/CCEGLView.h @@ -26,39 +26,32 @@ THE SOFTWARE. #ifndef __CC_EGLVIEW_ANDROID_H__ #define __CC_EGLVIEW_ANDROID_H__ +#include "CCObject.h" #include "CCGeometry.h" #include "platform/CCEGLViewProtocol.h" NS_CC_BEGIN -class CC_DLL EGLView : public EGLViewProtocol +class CC_DLL EGLView : public Object, public EGLViewProtocol { public: - /** - * @js ctor - */ + + // static function + static EGLView* create(const std::string &viewname); + static EGLView* createWithSize(const std::string& viewName, Size size, float frameZoomFactor = 1.0f); + static EGLView* createWithFullScreen(const std::string& viewName); + + bool isOpenGLReady() override; + void end() override; + void swapBuffers() override; + void setIMEKeyboardState(bool bOpen) override; + +protected: EGLView(); - /** - * @js NA - * @lua NA - */ virtual ~EGLView(); - bool isOpenGLReady(); - - // keep compatible - void end(); - void swapBuffers(); - void setIMEKeyboardState(bool bOpen); - - // static function - /** - @brief get the shared main open gl window - */ - static EGLView* getInstance(); - - /** @deprecated Use getInstance() instead */ - CC_DEPRECATED_ATTRIBUTE static EGLView* sharedOpenGLView(); + bool initWithSize(const std::string& viewName, Size size, float frameZoomFactor); + bool initWithFullScreen(const std::string& viewName); }; NS_CC_END diff --git a/cocos/2d/platform/android/java/project.properties b/cocos/2d/platform/android/java/project.properties index 88ca83f9d0..61afc8fe54 100644 --- a/cocos/2d/platform/android/java/project.properties +++ b/cocos/2d/platform/android/java/project.properties @@ -12,4 +12,4 @@ android.library=true # Project target. -target=android-10 +target=android-19 diff --git a/cocos/2d/platform/android/nativeactivity.cpp b/cocos/2d/platform/android/nativeactivity.cpp index 0e68cf0eb4..9327b81392 100644 --- a/cocos/2d/platform/android/nativeactivity.cpp +++ b/cocos/2d/platform/android/nativeactivity.cpp @@ -111,29 +111,27 @@ extern EditTextCallback s_pfEditTextCallback; extern void* s_ctx; extern "C" { - JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetEditTextDialogResult(JNIEnv * env, jobject obj, jbyteArray text) { - jsize size = env->GetArrayLength(text); - pthread_mutex_lock(&(engine.app->mutex)); - if (size > 0) { - + JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetEditTextDialogResult(JNIEnv * env, jobject obj, jbyteArray text) { + jsize size = env->GetArrayLength(text); + pthread_mutex_lock(&(engine.app->mutex)); + if (size > 0) { + jbyte * data = (jbyte*)env->GetByteArrayElements(text, 0); + char* pBuf = (char*)malloc(size+1); + if (pBuf != NULL) { + memcpy(pBuf, data, size); + pBuf[size] = '\0'; + editboxText = pBuf; + } + env->ReleaseByteArrayElements(text, data, 0); - jbyte * data = (jbyte*)env->GetByteArrayElements(text, 0); - char* pBuf = (char*)malloc(size+1); - if (pBuf != NULL) { - memcpy(pBuf, data, size); - pBuf[size] = '\0'; - editboxText = pBuf; - } - env->ReleaseByteArrayElements(text, data, 0); - - } else { - char* pBuf = (char*)malloc(1); - pBuf[0] = '\0'; - editboxText = pBuf; - } - pthread_cond_broadcast(&engine.app->cond); - pthread_mutex_unlock(&(engine.app->mutex)); - } + } else { + char* pBuf = (char*)malloc(1); + pBuf[0] = '\0'; + editboxText = pBuf; + } + pthread_cond_broadcast(&engine.app->cond); + pthread_mutex_unlock(&(engine.app->mutex)); + } } typedef struct cocos_dimensions { @@ -148,10 +146,13 @@ static void cocos_init(cocos_dimensions d, struct android_app* app) { cocos2d::FileUtilsAndroid::setassetmanager(app->activity->assetManager); - if (!cocos2d::Director::getInstance()->getOpenGLView()) + auto director = cocos2d::Director::getInstance(); + auto glview = director->getOpenGLView(); + if (!glview) { - cocos2d::EGLView *view = cocos2d::EGLView::getInstance(); - view->setFrameSize(d.w, d.h); + glview = cocos2d::EGLView::create("android app"); + director->setOpenGLView(glview); + glview->setFrameSize(d.w, d.h); cocos_android_app_init(app); @@ -163,16 +164,18 @@ static void cocos_init(cocos_dimensions d, struct android_app* app) { cocos2d::ShaderCache::getInstance()->reloadDefaultShaders(); cocos2d::DrawPrimitives::init(); cocos2d::VolatileTextureMgr::reloadAllTextures(); + cocos2d::EventCustom foregroundEvent(EVENT_COME_TO_FOREGROUND); - cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&foregroundEvent); - cocos2d::Director::getInstance()->setGLDefaultValues(); + director->getEventDispatcher()->dispatchEvent(&foregroundEvent); + director->setGLDefaultValues(); } } /** * Initialize an EGL context for the current display. */ -static cocos_dimensions engine_init_display(struct engine* engine) { +static cocos_dimensions engine_init_display(struct engine* engine) +{ cocos_dimensions r; r.w = -1; r.h = -1; @@ -293,14 +296,14 @@ static void engine_draw_frame(struct engine* engine) { /* // Just fill the screen with a color. */ /* glClearColor(((float)engine->state.x)/engine->width, engine->state.angle, */ /* ((float)engine->state.y)/engine->height, 1); */ - /* glClear(GL_COLOR_BUFFER_BIT); */ - - if (s_pfEditTextCallback && editboxText) - { - s_pfEditTextCallback(editboxText, s_ctx); - free(editboxText); - editboxText = NULL; - } + /* glClear(GL_COLOR_BUFFER_BIT); */ + + if (s_pfEditTextCallback && editboxText) + { + s_pfEditTextCallback(editboxText, s_ctx); + free(editboxText); + editboxText = NULL; + } eglSwapBuffers(engine->display, engine->surface); } @@ -390,7 +393,7 @@ static int32_t handle_touch_input(AInputEvent *event) { int ids[pointerCount]; float xs[pointerCount], ys[pointerCount]; getTouchPos(event, ids, xs, ys); - cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesMove(pointerCount, ids, xs, ys); + cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesMove(pointerCount, ids, xs, ys); return 1; } break; @@ -435,7 +438,7 @@ static int32_t handle_touch_input(AInputEvent *event) { int ids[pointerCount]; float xs[pointerCount], ys[pointerCount]; getTouchPos(event, ids, xs, ys); - cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesCancel(pointerCount, ids, xs, ys); + cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesCancel(pointerCount, ids, xs, ys); return 1; } break; @@ -458,7 +461,7 @@ static int32_t handle_key_input(AInputEvent *event) switch (AKeyEvent_getKeyCode(event)) { - case AKEYCODE_BACK: + case AKEYCODE_BACK: { cocos2d::EventKeyboard event(cocos2d::EventKeyboard::KeyCode::KEY_BACKSPACE, false); dispatcher->dispatchEvent(&event); @@ -494,8 +497,8 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event) return handle_touch_input(event); } - else - return handle_key_input(event); + else + return handle_key_input(event); return 0; } @@ -576,7 +579,7 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) { case APP_CMD_GAINED_FOCUS: if (cocos2d::Director::getInstance()->getOpenGLView()) { cocos2d::Application::getInstance()->applicationWillEnterForeground(); - engine->animating = 1; + engine->animating = 1; } break; @@ -594,8 +597,8 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) { } static void onContentRectChanged(ANativeActivity* activity, const ARect* rect) { - timeRectChanged = std::chrono::steady_clock::now(); - isContentRectChanged = true; + timeRectChanged = std::chrono::steady_clock::now(); + isContentRectChanged = true; } static void process_input(struct android_app* app, struct android_poll_source* source) { @@ -644,8 +647,8 @@ void android_main(struct android_app* state) { engine.state = *(struct saved_state*)state->savedState; } - // Screen size change support - state->activity->callbacks->onContentRectChanged = onContentRectChanged; + // Screen size change support + state->activity->callbacks->onContentRectChanged = onContentRectChanged; // loop waiting for stuff to do. @@ -735,19 +738,19 @@ void android_main(struct android_app* state) { LOG_RENDER_DEBUG("android_main : !engine.animating"); } - // Check if screen size changed - if (isContentRectChanged) { - std::chrono::duration duration( - std::chrono::duration_cast>(std::chrono::steady_clock::now() - timeRectChanged)); + // Check if screen size changed + if (isContentRectChanged) { + std::chrono::duration duration( + std::chrono::duration_cast>(std::chrono::steady_clock::now() - timeRectChanged)); - // Wait about 30 ms to get new width and height. Without waiting we can get old values sometime - if (duration.count() > 30) { - isContentRectChanged = false; + // Wait about 30 ms to get new width and height. Without waiting we can get old values sometime + if (duration.count() > 30) { + isContentRectChanged = false; - int32_t newWidth = ANativeWindow_getWidth(engine.app->window); - int32_t newHeight = ANativeWindow_getHeight(engine.app->window); - cocos2d::Application::getInstance()->applicationScreenSizeChanged(newWidth, newHeight); - } - } + int32_t newWidth = ANativeWindow_getWidth(engine.app->window); + int32_t newHeight = ANativeWindow_getHeight(engine.app->window); + cocos2d::Application::getInstance()->applicationScreenSizeChanged(newWidth, newHeight); + } + } } } diff --git a/cocos/2d/platform/desktop/CCEGLView.cpp b/cocos/2d/platform/desktop/CCEGLView.cpp index 9a9b80c215..25c3b9736a 100644 --- a/cocos/2d/platform/desktop/CCEGLView.cpp +++ b/cocos/2d/platform/desktop/CCEGLView.cpp @@ -205,7 +205,7 @@ void EGLViewEventHandler::onGLFWError(int errorID, const char* errorDesc) void EGLViewEventHandler::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int modify) { - EGLView* eglView = EGLView::getInstance(); + EGLView* eglView = Director::getInstance()->getOpenGLView(); if(nullptr == eglView) return; if(GLFW_MOUSE_BUTTON_LEFT == button) { @@ -249,7 +249,7 @@ void EGLViewEventHandler::onGLFWMouseCallBack(GLFWwindow* window, int button, in void EGLViewEventHandler::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y) { - EGLView* eglView = EGLView::getInstance(); + EGLView* eglView = Director::getInstance()->getOpenGLView(); if(nullptr == eglView) return; if (eglView->isRetina()) { @@ -280,7 +280,7 @@ void EGLViewEventHandler::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, void EGLViewEventHandler::onGLFWMouseScrollCallback(GLFWwindow* window, double x, double y) { - EGLView* eglView = EGLView::getInstance(); + EGLView* eglView = Director::getInstance()->getOpenGLView(); if(nullptr == eglView) return; EventMouse event(EventMouse::MouseEventType::MOUSE_SCROLL); @@ -312,7 +312,7 @@ void EGLViewEventHandler::onGLFWWindowPosCallback(GLFWwindow *windows, int x, in void EGLViewEventHandler::onGLFWframebuffersize(GLFWwindow* window, int w, int h) { - auto view = EGLView::getInstance(); + auto view = Director::getInstance()->getOpenGLView(); float frameSizeW = view->getFrameSize().width; float frameSizeH = view->getFrameSize().height; @@ -341,7 +341,39 @@ void EGLViewEventHandler::onGLFWframebuffersize(GLFWwindow* window, int w, int h // implement EGLView ////////////////////////////////////////////////////////////////////////// -EGLView* EGLView::s_pEglView = nullptr; + +EGLView* EGLView::create(const std::string& viewName) +{ + auto ret = new EGLView; + if(ret && ret->initWithSize(viewName, Size(960, 640), 1)) { + ret->autorelease(); + return ret; + } + + return nullptr; +} + +EGLView* EGLView::createWithSize(const std::string& viewName, Size size, float frameZoomFactor) +{ + auto ret = new EGLView; + if(ret && ret->initWithSize(viewName, size, frameZoomFactor)) { + ret->autorelease(); + return ret; + } + + return nullptr; +} + +EGLView* EGLView::createWithFullScreen(const std::string& viewName) +{ + auto ret = new EGLView(); + if(ret && ret->initWithFullScreen(viewName)) { + ret->autorelease(); + return ret; + } + + return nullptr; +} EGLView::EGLView() : _captured(false) @@ -351,9 +383,7 @@ EGLView::EGLView() , _mainWindow(nullptr) , _primaryMonitor(nullptr) { - CCASSERT(nullptr == s_pEglView, "EGLView is singleton, Should be inited only one time\n"); _viewName = "cocos2dx"; - s_pEglView = this; g_keyCodeMap.clear(); for (auto& item : g_keyCodeStructArray) { @@ -367,16 +397,12 @@ EGLView::~EGLView() { CCLOGINFO("deallocing EGLView: %p", this); glfwTerminate(); - s_pEglView = nullptr; } -bool EGLView::init(const std::string& viewName, float width, float height, float frameZoomFactor) +bool EGLView::initWithSize(const std::string& viewName, Size size, float frameZoomFactor) { - if(_mainWindow != nullptr) - return true; - setViewName(viewName); - setFrameSize(width, height); + setFrameSize(size.width, size.height); setFrameZoomFactor(frameZoomFactor); glfwWindowHint(GLFW_RESIZABLE,GL_FALSE); @@ -397,7 +423,7 @@ bool EGLView::init(const std::string& viewName, float width, float height, float { _isRetina = true; setFrameZoomFactor(frameZoomFactor * 2); - glfwSetWindowSize(_mainWindow, width/2 * _frameZoomFactor, height/2 * _frameZoomFactor); + glfwSetWindowSize(_mainWindow, size.width/2 * _frameZoomFactor, size.height/2 * _frameZoomFactor); } glfwSetMouseButtonCallback(_mainWindow,EGLViewEventHandler::onGLFWMouseCallBack); @@ -435,7 +461,7 @@ bool EGLView::initWithFullScreen(const std::string& viewName) return false; const GLFWvidmode* videoMode = glfwGetVideoMode(_primaryMonitor); - return init(viewName, videoMode->width, videoMode->height, 1.0f); + return initWithSize(viewName, Size(videoMode->width, videoMode->height), 1.0f); } bool EGLView::isOpenGLReady() @@ -505,18 +531,6 @@ void EGLView::setScissorInPoints(float x , float y , float w , float h) (GLsizei)(h * _scaleY * _frameZoomFactor)); } -EGLView* EGLView::getInstance() -{ - CCASSERT(nullptr != s_pEglView, "EGL singleton should not be null"); - return s_pEglView; -} - -// XXX: deprecated -EGLView* EGLView::sharedOpenGLView() -{ - return EGLView::getInstance(); -} - #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) static bool glew_dynamic_binding() { diff --git a/cocos/2d/platform/desktop/CCEGLView.h b/cocos/2d/platform/desktop/CCEGLView.h index 12670e2458..c5fa2752f8 100644 --- a/cocos/2d/platform/desktop/CCEGLView.h +++ b/cocos/2d/platform/desktop/CCEGLView.h @@ -26,52 +26,29 @@ THE SOFTWARE. #ifndef __CC_EGLVIEW_DESKTOP_H__ #define __CC_EGLVIEW_DESKTOP_H__ +#include "CCObject.h" #include "platform/CCCommon.h" #include "platform/CCEGLViewProtocol.h" #include "glfw3.h" NS_CC_BEGIN -class CC_DLL EGLView : public EGLViewProtocol +class CC_DLL EGLView : public Object, public EGLViewProtocol { public: - // static function - /** - @brief get the shared main open gl window - */ - static EGLView* getInstance(); + static EGLView* create(const std::string& viewName); + static EGLView* createWithSize(const std::string& viewName, Size size, float frameZoomFactor = 1.0f); + static EGLView* createWithFullScreen(const std::string& viewName); - /** @deprecated Use getInstance() instead */ - CC_DEPRECATED_ATTRIBUTE static EGLView* sharedOpenGLView(); - - /** - * @js ctor - */ - EGLView(); - /** - * @js NA - * @lua NA - */ - virtual ~EGLView(); - - /* override functions */ - virtual bool isOpenGLReady(); - virtual void end(); - virtual void swapBuffers(); - virtual void setFrameSize(float width, float height); - virtual void setIMEKeyboardState(bool bOpen); /* *frameZoomFactor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop. */ - bool init(const std::string& viewName, float width, float height, float frameZoomFactor = 1.0f); - bool initWithFullScreen(const std::string& viewName); //void resize(int width, int height); - float getFrameZoomFactor(); + float getFrameZoomFactor(); //void centerWindow(); - virtual void setViewPortInPoints(float x , float y , float w , float h); virtual void setScissorInPoints(float x , float y , float w , float h); @@ -80,7 +57,20 @@ public: void pollEvents(); GLFWwindow* getWindow() const { return _mainWindow; } + /* override functions */ + virtual bool isOpenGLReady() override; + virtual void end() override; + virtual void swapBuffers() override; + virtual void setFrameSize(float width, float height) override; + virtual void setIMEKeyboardState(bool bOpen) override; + protected: + EGLView(); + virtual ~EGLView(); + + bool initWithSize(const std::string& viewName, Size size, float frameZoomFactor); + bool initWithFullScreen(const std::string& viewName); + /* * Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop. */ @@ -93,11 +83,13 @@ protected: bool _isRetina; float _frameZoomFactor; - static EGLView* s_pEglView; GLFWwindow* _mainWindow; GLFWmonitor* _primaryMonitor; friend class EGLViewEventHandler; + +private: + CC_DISALLOW_COPY_AND_ASSIGN(EGLView); }; NS_CC_END // end of namespace cocos2d diff --git a/cocos/2d/platform/ios/EAGLView.h b/cocos/2d/platform/ios/CCEAGLView.h similarity index 100% rename from cocos/2d/platform/ios/EAGLView.h rename to cocos/2d/platform/ios/CCEAGLView.h diff --git a/cocos/2d/platform/ios/EAGLView.mm b/cocos/2d/platform/ios/CCEAGLView.mm similarity index 97% rename from cocos/2d/platform/ios/EAGLView.mm rename to cocos/2d/platform/ios/CCEAGLView.mm index e6ab5db271..d656742af9 100644 --- a/cocos/2d/platform/ios/EAGLView.mm +++ b/cocos/2d/platform/ios/CCEAGLView.mm @@ -63,7 +63,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. #import #import "CCEGLView.h" -#import "EAGLView.h" +#import "CCEAGLView.h" #import "CCES2Renderer.h" #import "CCDirector.h" #import "CCSet.h" @@ -413,7 +413,9 @@ static CCEAGLView *__view = 0; ys[i] = [touch locationInView: [touch view]].y * __view.contentScaleFactor;; ++i; } - cocos2d::EGLView::getInstance()->handleTouchesBegin(i, (int*)ids, xs, ys); + + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + glview->handleTouchesBegin(i, (int*)ids, xs, ys); } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event @@ -433,7 +435,9 @@ static CCEAGLView *__view = 0; ys[i] = [touch locationInView: [touch view]].y * __view.contentScaleFactor;; ++i; } - cocos2d::EGLView::getInstance()->handleTouchesMove(i, (int*)ids, xs, ys); + + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + glview->handleTouchesMove(i, (int*)ids, xs, ys); } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event @@ -454,7 +458,9 @@ static CCEAGLView *__view = 0; ys[i] = [touch locationInView: [touch view]].y * __view.contentScaleFactor;; ++i; } - cocos2d::EGLView::getInstance()->handleTouchesEnd(i, (int*)ids, xs, ys); + + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + glview->handleTouchesEnd(i, (int*)ids, xs, ys); } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event @@ -475,7 +481,9 @@ static CCEAGLView *__view = 0; ys[i] = [touch locationInView: [touch view]].y * __view.contentScaleFactor;; ++i; } - cocos2d::EGLView::getInstance()->handleTouchesCancel(i, (int*)ids, xs, ys); + + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + glview->handleTouchesCancel(i, (int*)ids, xs, ys); } #pragma mark - UIView - Responder @@ -794,9 +802,10 @@ static CCEAGLView *__view = 0; default: break; } - - float scaleX = cocos2d::EGLView::getInstance()->getScaleX(); - float scaleY = cocos2d::EGLView::getInstance()->getScaleY(); + + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + float scaleX = glview->getScaleX(); + float scaleY = glview->getScaleY(); if (self.contentScaleFactor == 2.0f) @@ -807,7 +816,7 @@ static CCEAGLView *__view = 0; end = CGRectApplyAffineTransform(end, CGAffineTransformScale(CGAffineTransformIdentity, 2.0f, 2.0f)); } - float offestY = cocos2d::EGLView::getInstance()->getViewPortRect().origin.y; + float offestY = glview->getViewPortRect().origin.y; CCLOG("offestY = %f", offestY); if (offestY < 0.0f) { @@ -870,7 +879,8 @@ static CCEAGLView *__view = 0; if (dis < 0.0f) dis = 0.0f; - dis *= cocos2d::EGLView::getInstance()->getScaleY(); + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + dis *= glview->getScaleY(); if (self.contentScaleFactor == 2.0f) { diff --git a/cocos/2d/platform/ios/CCEGLView.h b/cocos/2d/platform/ios/CCEGLView.h index 3dce046feb..47e1e1b0c6 100644 --- a/cocos/2d/platform/ios/CCEGLView.h +++ b/cocos/2d/platform/ios/CCEGLView.h @@ -26,6 +26,7 @@ #ifndef __CC_EGLVIEW_IPHONE_H__ #define __CC_EGLVIEW_IPHONE_H__ +#include "CCObject.h" #include "platform/CCCommon.h" #include "platform/CCEGLViewProtocol.h" @@ -33,58 +34,27 @@ NS_CC_BEGIN -class CC_DLL EGLView : public EGLViewProtocol +class CC_DLL EGLView : public Object, public EGLViewProtocol { public: - /** - * @js NA - * @lua NA - */ + static EGLView* create(const std::string& viewName); + static EGLView* createWithSize(const std::string& viewName, Size size, float frameZoomFactor = 1.0f); + static EGLView* createWithFullScreen(const std::string& viewName); + + virtual bool setContentScaleFactor(float contentScaleFactor); + + // overrides + virtual bool isOpenGLReady() override; + virtual void end() override; + virtual void swapBuffers() override; + virtual void setIMEKeyboardState(bool bOpen) override; + +protected: EGLView(); - /** - * @js NA - * @lua NA - */ - ~EGLView(); - /** - * @js NA - * @lua NA - */ - virtual bool isOpenGLReady(); - /** - * @js NA - * @lua NA - */ - virtual bool setContentScaleFactor(float contentScaleFactor); - - // keep compatible - /** - * @js NA - * @lua NA - */ - virtual void end(); - /** - * @js NA - * @lua NA - */ - virtual void swapBuffers(); - /** - * @js NA - * @lua NA - */ - virtual void setIMEKeyboardState(bool bOpen); - - /** returns the singleton - * @js NA - */ - static EGLView* getInstance(); - - /** @deprecated Use getInstance() instead - * @js NA - * @lua NA - */ - CC_DEPRECATED_ATTRIBUTE static EGLView* sharedOpenGLView(); + virtual ~EGLView(); + bool initWithSize(const std::string& viewName, Size size, float frameZoomFactor); + bool initWithFullScreen(const std::string& viewName); }; NS_CC_END diff --git a/cocos/2d/platform/ios/CCEGLView.mm b/cocos/2d/platform/ios/CCEGLView.mm index 399b365e56..1b6844a754 100644 --- a/cocos/2d/platform/ios/CCEGLView.mm +++ b/cocos/2d/platform/ios/CCEGLView.mm @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#include "EAGLView.h" +#include "CCEAGLView.h" #include "CCDirectorCaller.h" #include "CCEGLView.h" #include "CCSet.h" @@ -30,6 +30,39 @@ NS_CC_BEGIN +EGLView* EGLView::create(const std::string& viewName) +{ + auto ret = new EGLView; + if(ret && ret->initWithSize(viewName, Size(0,0), 1)) { + ret->autorelease(); + return ret; + } + + return nullptr; +} + +EGLView* EGLView::createWithSize(const std::string& viewName, Size size, float frameZoomFactor) +{ + auto ret = new EGLView; + if(ret && ret->initWithSize(viewName, size, frameZoomFactor)) { + ret->autorelease(); + return ret; + } + + return nullptr; +} + +EGLView* EGLView::createWithFullScreen(const std::string& viewName) +{ + auto ret = new EGLView(); + if(ret && ret->initWithFullScreen(viewName)) { + ret->autorelease(); + return ret; + } + + return nullptr; +} + EGLView::EGLView() { _screenSize.width = _designResolutionSize.width = [[CCEAGLView sharedEGLView] getWidth]; @@ -41,19 +74,29 @@ EGLView::~EGLView() } +bool EGLView::initWithSize(const std::string& viewName, Size size, float frameZoomFactor) +{ + return true; +} + +bool EGLView::initWithFullScreen(const std::string& viewName) +{ + return true; +} + bool EGLView::isOpenGLReady() { return [CCEAGLView sharedEGLView] != nullptr; } - + bool EGLView::setContentScaleFactor(float contentScaleFactor) { assert(_resolutionPolicy == ResolutionPolicy::UNKNOWN); // cannot enable retina mode - - _scaleX = _scaleY = contentScaleFactor; - [[CCEAGLView sharedEGLView] setNeedsLayout]; - - return true; + + _scaleX = _scaleY = contentScaleFactor; + [[CCEAGLView sharedEGLView] setNeedsLayout]; + + return true; } void EGLView::end() @@ -82,17 +125,6 @@ void EGLView::setIMEKeyboardState(bool bOpen) } } -EGLView* EGLView::getInstance() -{ - static EGLView instance; - return &instance; -} - -// XXX: deprecated -EGLView* EGLView::sharedOpenGLView() -{ - return EGLView::getInstance(); -} NS_CC_END diff --git a/cocos/2d/platform/mac/CCApplication.mm b/cocos/2d/platform/mac/CCApplication.mm index 0ece7367f4..88285d1fbd 100644 --- a/cocos/2d/platform/mac/CCApplication.mm +++ b/cocos/2d/platform/mac/CCApplication.mm @@ -54,12 +54,12 @@ int Application::run() { return 0; } - EGLView* pMainWnd = EGLView::getInstance(); + EGLView* glview = Director::getInstance()->getOpenGLView(); - while (!pMainWnd->windowShouldClose()) + while (!glview->windowShouldClose()) { Director::getInstance()->mainLoop(); - pMainWnd->pollEvents(); + glview->pollEvents(); } /* Only work on Desktop diff --git a/cocos/2d/platform/mac/CCCommon.mm b/cocos/2d/platform/mac/CCCommon.mm index d36241ee7b..27b3d889f4 100644 --- a/cocos/2d/platform/mac/CCCommon.mm +++ b/cocos/2d/platform/mac/CCCommon.mm @@ -23,7 +23,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "platform/CCCommon.h" + +#include "CCDirector.h" #include "CCEGLView.h" + #define GLFW_EXPOSE_NATIVE_NSGL #define GLFW_EXPOSE_NATIVE_COCOA #include "glfw3native.h" @@ -51,7 +54,8 @@ void MessageBox(const char * msg, const char * title) [alert setInformativeText:tmpTitle]; [alert setAlertStyle:NSWarningAlertStyle]; - id window = glfwGetCocoaWindow(EGLView::getInstance()->getWindow()); + EGLView* glview = Director::getInstance()->getOpenGLView(); + id window = glfwGetCocoaWindow(glview->getWindow()); [alert beginSheetModalForWindow:window modalDelegate:[window delegate] didEndSelector:nil diff --git a/cocos/gui/UILayout.cpp b/cocos/gui/UILayout.cpp index e73a2cab3a..93889d7ce0 100644 --- a/cocos/gui/UILayout.cpp +++ b/cocos/gui/UILayout.cpp @@ -324,7 +324,8 @@ void Layout::onBeforeVisitScissor() { Rect clippingRect = getClippingRect(); glEnable(GL_SCISSOR_TEST); - EGLView::getInstance()->setScissorInPoints(clippingRect.origin.x, clippingRect.origin.y, clippingRect.size.width, clippingRect.size.height); + auto glview = Director::getInstance()->getOpenGLView(); + glview->setScissorInPoints(clippingRect.origin.x, clippingRect.origin.y, clippingRect.size.width, clippingRect.size.height); } void Layout::onAfterVisitScissor() diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index 25b07839ea..2f3bb67234 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -29,15 +29,18 @@ #define kLabelZOrder 9999 #include "CCEditBox.h" -#import "EAGLView.h" +#import "CCEAGLView.h" #define getEditBoxImplIOS() ((cocos2d::extension::EditBoxImplIOS*)editBox_) static const int CC_EDIT_BOX_PADDING = 5; @implementation CCCustomUITextField -- (CGRect)textRectForBounds:(CGRect)bounds { - float padding = CC_EDIT_BOX_PADDING * cocos2d::EGLView::getInstance()->getScaleX() / [[CCEAGLView sharedEGLView] contentScaleFactor ]; +- (CGRect)textRectForBounds:(CGRect)bounds +{ + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + + float padding = CC_EDIT_BOX_PADDING * glview->getScaleX() / [[CCEAGLView sharedEGLView] contentScaleFactor ]; return CGRectMake(bounds.origin.x + padding, bounds.origin.y + padding, bounds.size.width - padding*2, bounds.size.height - padding*2); } @@ -281,9 +284,9 @@ bool EditBoxImplIOS::initWithSize(const Size& size) { do { - EGLViewProtocol* eglView = EGLView::getInstance(); + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); - CGRect rect = CGRectMake(0, 0, size.width * eglView->getScaleX(),size.height * eglView->getScaleY()); + CGRect rect = CGRectMake(0, 0, size.width * glview->getScaleX(),size.height * glview->getScaleY()); if (_inRetinaMode) { @@ -358,7 +361,10 @@ void EditBoxImplIOS::setFont(const char* pFontName, int fontSize) float retinaFactor = _inRetinaMode ? 2.0f : 1.0f; NSString * fntName = [NSString stringWithUTF8String:pFontName]; - float scaleFactor = EGLView::getInstance()->getScaleX(); + + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + + float scaleFactor = glview->getScaleX(); UIFont *textFont = nil; if (isValidFontName) { textFont = [UIFont fontWithName:fntName size:fontSize * scaleFactor / retinaFactor]; @@ -528,11 +534,11 @@ void EditBoxImplIOS::setPlaceHolder(const char* pText) static CGPoint convertDesignCoordToScreenCoord(const Point& designCoord, bool bInRetinaMode) { - EGLViewProtocol* eglView = EGLView::getInstance(); + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); float viewH = (float)[[CCEAGLView sharedEGLView] getHeight]; - Point visiblePos = Point(designCoord.x * eglView->getScaleX(), designCoord.y * eglView->getScaleY()); - Point screenGLPos = visiblePos + eglView->getViewPortRect().origin; + Point visiblePos = Point(designCoord.x * glview->getScaleX(), designCoord.y * glview->getScaleY()); + Point screenGLPos = visiblePos + glview->getViewPortRect().origin; CGPoint screenPos = CGPointMake(screenGLPos.x, viewH - screenGLPos.y); @@ -561,8 +567,8 @@ void EditBoxImplIOS::setContentSize(const Size& size) _contentSize = size; CCLOG("[Edit text] content size = (%f, %f)", size.width, size.height); placeInactiveLabels(); - EGLViewProtocol* eglView = EGLView::getInstance(); - CGSize controlSize = CGSizeMake(size.width * eglView->getScaleX(),size.height * eglView->getScaleY()); + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + CGSize controlSize = CGSizeMake(size.width * glview->getScaleX(),size.height * glview->getScaleY()); if (_inRetinaMode) { diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm index cdfab6a402..3aab0c5fca 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm @@ -24,6 +24,7 @@ ****************************************************************************/ #include "CCEditBoxImplMac.h" +#include "CCDirector.h" #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) @@ -63,8 +64,10 @@ @synthesize editState = editState_; @synthesize editBox = editBox_; -- (id) getNSWindow { - return glfwGetCocoaWindow(cocos2d::EGLView::getInstance()->getWindow()); +- (id) getNSWindow +{ + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + return glfwGetCocoaWindow(glview->getWindow()); } - (void)dealloc @@ -265,7 +268,7 @@ void EditBoxImplMac::doAnimationWhenKeyboardMove(float duration, float distance) bool EditBoxImplMac::initWithSize(const Size& size) { - EGLViewProtocol* eglView = EGLView::getInstance(); + EGLViewProtocol* eglView = Director::getInstance()->getOpenGLView(); NSRect rect = NSMakeRect(0, 0, size.width * eglView->getScaleX(),size.height * eglView->getScaleY()); @@ -356,7 +359,7 @@ NSPoint EditBoxImplMac::convertDesignCoordToScreenCoord(const Point& designCoord NSRect frame = [_sysEdit.textField frame]; CGFloat height = frame.size.height; - EGLViewProtocol* eglView = EGLView::getInstance(); + EGLViewProtocol* eglView = Director::getInstance()->getOpenGLView(); Point visiblePos = Point(designCoord.x * eglView->getScaleX(), designCoord.y * eglView->getScaleY()); Point screenGLPos = visiblePos + eglView->getViewPortRect().origin; diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp index 4cc76e6dde..2825201cec 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -44,7 +44,8 @@ NS_CC_EXT_BEGIN static float convertDistanceFromPointToInch(float pointDis) { - float factor = ( EGLView::getInstance()->getScaleX() + EGLView::getInstance()->getScaleY() ) / 2; + auto glview = Director::getInstance()->getOpenGLView(); + float factor = ( glview->getScaleX() + glview->getScaleY() ) / 2; return pointDis * factor / Device::getDPI(); } @@ -508,21 +509,23 @@ void ScrollView::onBeforeDraw() { _scissorRestored = false; Rect frame = getViewRect(); - if (EGLView::getInstance()->isScissorEnabled()) { + auto glview = Director::getInstance()->getOpenGLView(); + + if (glview->isScissorEnabled()) { _scissorRestored = true; - _parentScissorRect = EGLView::getInstance()->getScissorRect(); + _parentScissorRect = glview->getScissorRect(); //set the intersection of _parentScissorRect and frame as the new scissor rect if (frame.intersectsRect(_parentScissorRect)) { float x = MAX(frame.origin.x, _parentScissorRect.origin.x); float y = MAX(frame.origin.y, _parentScissorRect.origin.y); float xx = MIN(frame.origin.x+frame.size.width, _parentScissorRect.origin.x+_parentScissorRect.size.width); float yy = MIN(frame.origin.y+frame.size.height, _parentScissorRect.origin.y+_parentScissorRect.size.height); - EGLView::getInstance()->setScissorInPoints(x, y, xx-x, yy-y); + glview->setScissorInPoints(x, y, xx-x, yy-y); } } else { glEnable(GL_SCISSOR_TEST); - EGLView::getInstance()->setScissorInPoints(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); + glview->setScissorInPoints(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); } } } @@ -543,7 +546,9 @@ void ScrollView::onAfterDraw() if (_clippingToBounds) { if (_scissorRestored) {//restore the parent's scissor rect - EGLView::getInstance()->setScissorInPoints(_parentScissorRect.origin.x, _parentScissorRect.origin.y, _parentScissorRect.size.width, _parentScissorRect.size.height); + auto glview = Director::getInstance()->getOpenGLView(); + + glview->setScissorInPoints(_parentScissorRect.origin.x, _parentScissorRect.origin.y, _parentScissorRect.size.width, _parentScissorRect.size.height); } else { glDisable(GL_SCISSOR_TEST); diff --git a/samples/Cpp/HelloCpp/Classes/AppDelegate.cpp b/samples/Cpp/HelloCpp/Classes/AppDelegate.cpp index 97fb7366c3..04961ee215 100644 --- a/samples/Cpp/HelloCpp/Classes/AppDelegate.cpp +++ b/samples/Cpp/HelloCpp/Classes/AppDelegate.cpp @@ -20,14 +20,14 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director auto director = Director::getInstance(); - auto glView = EGLView::getInstance(); + auto glview = EGLView::createWithSize("Hello Cpp", Size(900,640)); - director->setOpenGLView(glView); + director->setOpenGLView(glview); // Set the design resolution - glView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER); + glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER); - Size frameSize = glView->getFrameSize(); + Size frameSize = glview->getFrameSize(); vector searchPath; diff --git a/samples/Cpp/HelloCpp/Classes/AppMacros.h b/samples/Cpp/HelloCpp/Classes/AppMacros.h index 6e6aa0ea2e..417da9a190 100644 --- a/samples/Cpp/HelloCpp/Classes/AppMacros.h +++ b/samples/Cpp/HelloCpp/Classes/AppMacros.h @@ -51,6 +51,6 @@ static cocos2d::Size designResolutionSize = cocos2d::Size(2048, 1536); #endif // The font size 24 is designed for small resolution, so we should change it to fit for current design resolution -#define TITLE_FONT_SIZE (cocos2d::EGLView::getInstance()->getDesignResolutionSize().width / smallResource.size.width * 24) +#define TITLE_FONT_SIZE (cocos2d::Director::getInstance()->getOpenGLView()->getDesignResolutionSize().width / smallResource.size.width * 24) #endif /* __APPMACROS_H__ */ diff --git a/samples/Cpp/HelloCpp/proj.ios/AppController.mm b/samples/Cpp/HelloCpp/proj.ios/AppController.mm index 5e2010ba4c..5faa098827 100644 --- a/samples/Cpp/HelloCpp/proj.ios/AppController.mm +++ b/samples/Cpp/HelloCpp/proj.ios/AppController.mm @@ -24,7 +24,7 @@ #import #import "AppController.h" #import "cocos2d.h" -#import "EAGLView.h" +#import "CCEAGLView.h" #import "AppDelegate.h" #import "RootViewController.h" diff --git a/samples/Cpp/HelloCpp/proj.mac/main.cpp b/samples/Cpp/HelloCpp/proj.mac/main.cpp index 4bba4a37b3..f2bc5c2a4e 100644 --- a/samples/Cpp/HelloCpp/proj.mac/main.cpp +++ b/samples/Cpp/HelloCpp/proj.mac/main.cpp @@ -29,8 +29,6 @@ USING_NS_CC; int main(int argc, char *argv[]) { AppDelegate app; - EGLView eglView; - eglView.init("HelloCpp",900,640); return Application::getInstance()->run(); } diff --git a/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp b/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp index 03b9b81ae4..ba500209f3 100644 --- a/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp +++ b/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp @@ -15,10 +15,11 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director auto director = Director::getInstance(); + auto glview = EGLView::createWithSize("Simple Game", Size(900,640)); + + director->setOpenGLView(glview); - director->setOpenGLView(EGLView::getInstance()); - - auto screenSize = EGLView::getInstance()->getFrameSize(); + auto screenSize = glview->getFrameSize(); auto designSize = Size(480, 320); std::vector searchPaths; @@ -36,7 +37,7 @@ bool AppDelegate::applicationDidFinishLaunching() { FileUtils::getInstance()->setSearchPaths(searchPaths); - EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER); + glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER); // turn on display FPS director->setDisplayStats(true); diff --git a/samples/Cpp/SimpleGame/proj.ios/AppController.mm b/samples/Cpp/SimpleGame/proj.ios/AppController.mm index 5e2010ba4c..5faa098827 100644 --- a/samples/Cpp/SimpleGame/proj.ios/AppController.mm +++ b/samples/Cpp/SimpleGame/proj.ios/AppController.mm @@ -24,7 +24,7 @@ #import #import "AppController.h" #import "cocos2d.h" -#import "EAGLView.h" +#import "CCEAGLView.h" #import "AppDelegate.h" #import "RootViewController.h" diff --git a/samples/Cpp/SimpleGame/proj.mac/main.cpp b/samples/Cpp/SimpleGame/proj.mac/main.cpp index edc200d976..f2bc5c2a4e 100644 --- a/samples/Cpp/SimpleGame/proj.mac/main.cpp +++ b/samples/Cpp/SimpleGame/proj.mac/main.cpp @@ -29,8 +29,6 @@ USING_NS_CC; int main(int argc, char *argv[]) { AppDelegate app; - EGLView eglView; - eglView.init("SimpleGame",900,640); return Application::getInstance()->run(); } diff --git a/samples/Cpp/TestCpp/Classes/AppDelegate.cpp b/samples/Cpp/TestCpp/Classes/AppDelegate.cpp index 285d9b17ae..997e9f3db4 100644 --- a/samples/Cpp/TestCpp/Classes/AppDelegate.cpp +++ b/samples/Cpp/TestCpp/Classes/AppDelegate.cpp @@ -26,14 +26,16 @@ bool AppDelegate::applicationDidFinishLaunching() // XXX: but at this point, the director is already initialized Configuration::getInstance()->loadConfigFile("configs/config-example.plist"); + auto glview = EGLView::create("Test Cpp"); + // initialize director auto director = Director::getInstance(); - director->setOpenGLView(EGLView::getInstance()); + director->setOpenGLView(glview); director->setDisplayStats(true); director->setAnimationInterval(1.0 / 60); - auto screenSize = EGLView::getInstance()->getFrameSize(); + auto screenSize = glview->getFrameSize(); auto designSize = Size(480, 320); @@ -73,7 +75,7 @@ bool AppDelegate::applicationDidFinishLaunching() pFileUtils->setSearchPaths(searchPaths); - EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER); + glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER); auto scene = Scene::create(); auto layer = new TestController(); diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp index 961f9f8e2d..eb788bb2b2 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/EditBoxTest/EditBoxTest.cpp @@ -15,8 +15,9 @@ USING_NS_CC_EXT; EditBoxTest::EditBoxTest() { - auto visibleOrigin = EGLView::getInstance()->getVisibleOrigin(); - auto visibleSize = EGLView::getInstance()->getVisibleSize(); + auto glview = Director::getInstance()->getOpenGLView(); + auto visibleOrigin = glview->getVisibleOrigin(); + auto visibleSize = glview->getVisibleSize(); auto pBg = Sprite::create("Images/HelloWorld.png"); pBg->setPosition(Point(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2)); diff --git a/samples/Cpp/TestCpp/Classes/VisibleRect.cpp b/samples/Cpp/TestCpp/Classes/VisibleRect.cpp index 2686a1b821..94a494a02e 100644 --- a/samples/Cpp/TestCpp/Classes/VisibleRect.cpp +++ b/samples/Cpp/TestCpp/Classes/VisibleRect.cpp @@ -6,7 +6,7 @@ void VisibleRect::lazyInit() { if (s_visibleRect.size.width == 0.0f && s_visibleRect.size.height == 0.0f) { - auto glView = EGLView::getInstance(); + auto glView = Director::getInstance()->getOpenGLView(); s_visibleRect.origin = glView->getVisibleOrigin(); s_visibleRect.size = glView->getVisibleSize(); } diff --git a/samples/Cpp/TestCpp/proj.android/project.properties b/samples/Cpp/TestCpp/proj.android/project.properties index 0a6dc6664d..ae6cda34ce 100644 --- a/samples/Cpp/TestCpp/proj.android/project.properties +++ b/samples/Cpp/TestCpp/proj.android/project.properties @@ -8,6 +8,6 @@ # project structure. # Project target. -target=android-10 +target=android-19 android.library.reference.1=../../../../cocos/2d/platform/android/java diff --git a/samples/Cpp/TestCpp/proj.ios/Classes/testsAppDelegate.mm b/samples/Cpp/TestCpp/proj.ios/Classes/testsAppDelegate.mm index 55b5156c7f..7473da28a0 100644 --- a/samples/Cpp/TestCpp/proj.ios/Classes/testsAppDelegate.mm +++ b/samples/Cpp/TestCpp/proj.ios/Classes/testsAppDelegate.mm @@ -8,7 +8,7 @@ #import "testsAppDelegate.h" -#import "EAGLView.h" +#import "CCEAGLView.h" #import "cocos2d.h" #import "AppDelegate.h" #import "RootViewController.h" diff --git a/samples/Cpp/TestCpp/proj.mac/main.cpp b/samples/Cpp/TestCpp/proj.mac/main.cpp index 37600cec7a..1814d16c15 100644 --- a/samples/Cpp/TestCpp/proj.mac/main.cpp +++ b/samples/Cpp/TestCpp/proj.mac/main.cpp @@ -29,7 +29,5 @@ USING_NS_CC; int main(int argc, char *argv[]) { AppDelegate app; - EGLView eglView; - eglView.init("TestCPP",900,640); return Application::getInstance()->run(); } diff --git a/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp b/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp index d8ec78b296..d738d1121d 100644 --- a/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp +++ b/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp @@ -32,14 +32,15 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director - auto pDirector = Director::getInstance(); - pDirector->setOpenGLView(EGLView::getInstance()); - pDirector->setProjection(Director::Projection::_2D); + auto director = Director::getInstance(); + auto glview = EGLView::createWithSize("CocosDragon JS", Size(480, 720)); + director->setOpenGLView(glview); + director->setProjection(Director::Projection::_2D); FileUtils::getInstance()->addSearchPath("script"); - auto screenSize = EGLView::getInstance()->getFrameSize(); + auto screenSize = glview->getFrameSize(); auto designSize = Size(320, 480); auto resourceSize = Size(320, 480); @@ -110,15 +111,15 @@ bool AppDelegate::applicationDidFinishLaunching() FileUtils::getInstance()->setSearchResolutionsOrder(resDirOrders); - pDirector->setContentScaleFactor(resourceSize.width/designSize.width); + director->setContentScaleFactor(resourceSize.width/designSize.width); - EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER); + glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER); // turn on display FPS - pDirector->setDisplayStats(true); + director->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this - pDirector->setAnimationInterval(1.0 / 60); + director->setAnimationInterval(1.0 / 60); ScriptingCore* sc = ScriptingCore::getInstance(); sc->addRegisterCallback(register_all_cocos2dx); diff --git a/samples/Javascript/CocosDragonJS/proj.ios/AppController.mm b/samples/Javascript/CocosDragonJS/proj.ios/AppController.mm index ca23f1b7f8..fa17e97cd9 100644 --- a/samples/Javascript/CocosDragonJS/proj.ios/AppController.mm +++ b/samples/Javascript/CocosDragonJS/proj.ios/AppController.mm @@ -8,7 +8,7 @@ #import #import "AppController.h" #import "cocos2d.h" -#import "EAGLView.h" +#import "CCEAGLView.h" #import "AppDelegate.h" #import "RootViewController.h" diff --git a/samples/Javascript/CocosDragonJS/proj.mac/main.cpp b/samples/Javascript/CocosDragonJS/proj.mac/main.cpp index cc76835ef2..96f027e13d 100644 --- a/samples/Javascript/CocosDragonJS/proj.mac/main.cpp +++ b/samples/Javascript/CocosDragonJS/proj.mac/main.cpp @@ -30,7 +30,5 @@ USING_NS_CC; int main(int argc, char *argv[]) { AppDelegate app; - EGLView eglView; - eglView.init("CocosDragonJS", 480, 720); return Application::getInstance()->run(); } diff --git a/samples/Javascript/CrystalCraze/Classes/AppDelegate.cpp b/samples/Javascript/CrystalCraze/Classes/AppDelegate.cpp index f8cd0ab32d..23f534b9d4 100644 --- a/samples/Javascript/CrystalCraze/Classes/AppDelegate.cpp +++ b/samples/Javascript/CrystalCraze/Classes/AppDelegate.cpp @@ -28,13 +28,15 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director - auto pDirector = Director::getInstance(); - pDirector->setOpenGLView(EGLView::getInstance()); - pDirector->setProjection(Director::Projection::_2D); + auto director = Director::getInstance(); + auto glview = EGLView::createWithSize("Crystal Craze", Size(480, 720)); + + director->setOpenGLView(glview); + director->setProjection(Director::Projection::_2D); FileUtils::getInstance()->addSearchPath("script"); - auto screenSize = EGLView::getInstance()->getFrameSize(); + auto screenSize = glview->getFrameSize(); auto designSize = Size(320, 480); auto resourceSize = Size(320, 480); @@ -91,15 +93,15 @@ bool AppDelegate::applicationDidFinishLaunching() FileUtils::getInstance()->setSearchResolutionsOrder(resDirOrders); } - pDirector->setContentScaleFactor(resourceSize.width/designSize.width); + director->setContentScaleFactor(resourceSize.width/designSize.width); - EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL); + glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL); // turn on display FPS - pDirector->setDisplayStats(true); + director->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this - pDirector->setAnimationInterval(1.0 / 60); + director->setAnimationInterval(1.0 / 60); ScriptingCore* sc = ScriptingCore::getInstance(); sc->addRegisterCallback(register_all_cocos2dx); diff --git a/samples/Javascript/CrystalCraze/proj.ios/AppController.mm b/samples/Javascript/CrystalCraze/proj.ios/AppController.mm index ca23f1b7f8..fa17e97cd9 100644 --- a/samples/Javascript/CrystalCraze/proj.ios/AppController.mm +++ b/samples/Javascript/CrystalCraze/proj.ios/AppController.mm @@ -8,7 +8,7 @@ #import #import "AppController.h" #import "cocos2d.h" -#import "EAGLView.h" +#import "CCEAGLView.h" #import "AppDelegate.h" #import "RootViewController.h" diff --git a/samples/Javascript/CrystalCraze/proj.mac/main.cpp b/samples/Javascript/CrystalCraze/proj.mac/main.cpp index fecfe31ab8..96f027e13d 100644 --- a/samples/Javascript/CrystalCraze/proj.mac/main.cpp +++ b/samples/Javascript/CrystalCraze/proj.mac/main.cpp @@ -30,7 +30,5 @@ USING_NS_CC; int main(int argc, char *argv[]) { AppDelegate app; - EGLView eglView; - eglView.init("CrystalCraze", 480, 720); return Application::getInstance()->run(); } diff --git a/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp b/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp index ee9406b274..8fd1e2ed4c 100644 --- a/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp +++ b/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp @@ -28,18 +28,20 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director - auto pDirector = Director::getInstance(); - pDirector->setOpenGLView(EGLView::getInstance()); - pDirector->setProjection(Director::Projection::_2D); + auto director = Director::getInstance(); + auto glview = EGLView::createWithSize("Moon Warriors", Size(480, 720)); + + director->setOpenGLView(glview); + director->setProjection(Director::Projection::_2D); // Set the design resolution - EGLView::getInstance()->setDesignResolutionSize(320, 480, ResolutionPolicy::SHOW_ALL); + glview->setDesignResolutionSize(320, 480, ResolutionPolicy::SHOW_ALL); // turn on display FPS - pDirector->setDisplayStats(true); + director->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this - pDirector->setAnimationInterval(1.0 / 60); + director->setAnimationInterval(1.0 / 60); FileUtils::getInstance()->addSearchPath("script"); diff --git a/samples/Javascript/MoonWarriors/proj.ios/AppController.mm b/samples/Javascript/MoonWarriors/proj.ios/AppController.mm index ca23f1b7f8..fa17e97cd9 100644 --- a/samples/Javascript/MoonWarriors/proj.ios/AppController.mm +++ b/samples/Javascript/MoonWarriors/proj.ios/AppController.mm @@ -8,7 +8,7 @@ #import #import "AppController.h" #import "cocos2d.h" -#import "EAGLView.h" +#import "CCEAGLView.h" #import "AppDelegate.h" #import "RootViewController.h" diff --git a/samples/Javascript/MoonWarriors/proj.mac/main.cpp b/samples/Javascript/MoonWarriors/proj.mac/main.cpp index 1c421ad511..4b6a1e9021 100644 --- a/samples/Javascript/MoonWarriors/proj.mac/main.cpp +++ b/samples/Javascript/MoonWarriors/proj.mac/main.cpp @@ -30,8 +30,6 @@ USING_NS_CC; int main(int argc, char *argv[]) { AppDelegate app; - EGLView eglView; - eglView.init("MoonWarriors", 480, 720); return Application::getInstance()->run(); } diff --git a/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp b/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp index ec3a33e02b..263c4184ee 100644 --- a/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp +++ b/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp @@ -37,16 +37,18 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director - auto pDirector = Director::getInstance(); - pDirector->setOpenGLView(EGLView::getInstance()); + auto director = Director::getInstance(); + auto glview = EGLView::createWithSize("Test JavaScript", Size(900,640)); + + director->setOpenGLView(glview); // JS-Test in Html5 uses 800x450 as design resolution - EGLView::getInstance()->setDesignResolutionSize(800, 450, ResolutionPolicy::FIXED_HEIGHT); + glview->setDesignResolutionSize(800, 450, ResolutionPolicy::FIXED_HEIGHT); // turn on display FPS - pDirector->setDisplayStats(true); + director->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this - pDirector->setAnimationInterval(1.0 / 60); + director->setAnimationInterval(1.0 / 60); auto fileUtils = FileUtils::getInstance(); std::vector searchPaths; diff --git a/samples/Javascript/TestJavascript/proj.ios/AppController.mm b/samples/Javascript/TestJavascript/proj.ios/AppController.mm index 5cd84017c9..20fe3778da 100644 --- a/samples/Javascript/TestJavascript/proj.ios/AppController.mm +++ b/samples/Javascript/TestJavascript/proj.ios/AppController.mm @@ -8,7 +8,7 @@ #import #import "AppController.h" #import "cocos2d.h" -#import "EAGLView.h" +#import "CCEAGLView.h" #import "AppDelegate.h" #import "RootViewController.h" diff --git a/samples/Javascript/TestJavascript/proj.mac/main.cpp b/samples/Javascript/TestJavascript/proj.mac/main.cpp index 993742b406..4b6a1e9021 100644 --- a/samples/Javascript/TestJavascript/proj.mac/main.cpp +++ b/samples/Javascript/TestJavascript/proj.mac/main.cpp @@ -30,8 +30,6 @@ USING_NS_CC; int main(int argc, char *argv[]) { AppDelegate app; - EGLView eglView; - eglView.init("TestJavascript",900,640); return Application::getInstance()->run(); } diff --git a/samples/Javascript/WatermelonWithMe/Classes/AppDelegate.cpp b/samples/Javascript/WatermelonWithMe/Classes/AppDelegate.cpp index a6798abad9..081a7eb64c 100644 --- a/samples/Javascript/WatermelonWithMe/Classes/AppDelegate.cpp +++ b/samples/Javascript/WatermelonWithMe/Classes/AppDelegate.cpp @@ -28,16 +28,17 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director - auto pDirector = Director::getInstance(); - pDirector->setOpenGLView(EGLView::getInstance()); + auto director = Director::getInstance(); + auto glview = EGLView::createWithSize("Watermelon With Me", Size(900,640)); + director->setOpenGLView(glview); // turn on display FPS - pDirector->setDisplayStats(true); + director->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this - pDirector->setAnimationInterval(1.0 / 60); + director->setAnimationInterval(1.0 / 60); - EGLView::getInstance()->setDesignResolutionSize(480, 320, ResolutionPolicy::FIXED_HEIGHT); + glview->setDesignResolutionSize(480, 320, ResolutionPolicy::FIXED_HEIGHT); FileUtils::getInstance()->addSearchPath("script"); diff --git a/samples/Javascript/WatermelonWithMe/proj.ios/AppController.mm b/samples/Javascript/WatermelonWithMe/proj.ios/AppController.mm index ca23f1b7f8..fa17e97cd9 100644 --- a/samples/Javascript/WatermelonWithMe/proj.ios/AppController.mm +++ b/samples/Javascript/WatermelonWithMe/proj.ios/AppController.mm @@ -8,7 +8,7 @@ #import #import "AppController.h" #import "cocos2d.h" -#import "EAGLView.h" +#import "CCEAGLView.h" #import "AppDelegate.h" #import "RootViewController.h" diff --git a/samples/Javascript/WatermelonWithMe/proj.mac/main.cpp b/samples/Javascript/WatermelonWithMe/proj.mac/main.cpp index b4bf804f38..4b6a1e9021 100644 --- a/samples/Javascript/WatermelonWithMe/proj.mac/main.cpp +++ b/samples/Javascript/WatermelonWithMe/proj.mac/main.cpp @@ -30,8 +30,6 @@ USING_NS_CC; int main(int argc, char *argv[]) { AppDelegate app; - EGLView eglView; - eglView.init("WatermelonWithMe",900,640); return Application::getInstance()->run(); } diff --git a/samples/Lua/HelloLua/Classes/AppDelegate.cpp b/samples/Lua/HelloLua/Classes/AppDelegate.cpp index d693936216..be15ff7a2f 100644 --- a/samples/Lua/HelloLua/Classes/AppDelegate.cpp +++ b/samples/Lua/HelloLua/Classes/AppDelegate.cpp @@ -23,16 +23,18 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director - auto pDirector = Director::getInstance(); - pDirector->setOpenGLView(EGLView::getInstance()); + auto director = Director::getInstance(); + auto glview = EGLView::createWithSize("Hello Lua", Size(900,640)); + + director->setOpenGLView(glview); - EGLView::getInstance()->setDesignResolutionSize(480, 320, ResolutionPolicy::NO_BORDER); + glview->setDesignResolutionSize(480, 320, ResolutionPolicy::NO_BORDER); // turn on display FPS - pDirector->setDisplayStats(true); + director->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this - pDirector->setAnimationInterval(1.0 / 60); + director->setAnimationInterval(1.0 / 60); // register lua engine LuaEngine* pEngine = LuaEngine::getInstance(); diff --git a/samples/Lua/HelloLua/proj.ios/AppController.mm b/samples/Lua/HelloLua/proj.ios/AppController.mm index e87a13dbc9..cd42e11be5 100644 --- a/samples/Lua/HelloLua/proj.ios/AppController.mm +++ b/samples/Lua/HelloLua/proj.ios/AppController.mm @@ -24,7 +24,7 @@ #import #import "AppController.h" #import "cocos2d.h" -#import "EAGLView.h" +#import "CCEAGLView.h" #import "AppDelegate.h" #import "RootViewController.h" diff --git a/samples/Lua/HelloLua/proj.mac/main.cpp b/samples/Lua/HelloLua/proj.mac/main.cpp index 0a43aa7cd7..96f027e13d 100644 --- a/samples/Lua/HelloLua/proj.mac/main.cpp +++ b/samples/Lua/HelloLua/proj.mac/main.cpp @@ -30,7 +30,5 @@ USING_NS_CC; int main(int argc, char *argv[]) { AppDelegate app; - EGLView eglView; - eglView.init("HelloLua",900,640); return Application::getInstance()->run(); } diff --git a/samples/Lua/TestLua/Classes/AppDelegate.cpp b/samples/Lua/TestLua/Classes/AppDelegate.cpp index fadd0b1c25..31329bb48d 100644 --- a/samples/Lua/TestLua/Classes/AppDelegate.cpp +++ b/samples/Lua/TestLua/Classes/AppDelegate.cpp @@ -20,16 +20,18 @@ AppDelegate::~AppDelegate() bool AppDelegate::applicationDidFinishLaunching() { // initialize director - auto pDirector = Director::getInstance(); - pDirector->setOpenGLView(EGLView::getInstance()); + auto director = Director::getInstance(); + auto glview = EGLView::createWithSize("Test Lua", Size(900,640)); + + director->setOpenGLView(glview); // turn on display FPS - pDirector->setDisplayStats(true); + director->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this - pDirector->setAnimationInterval(1.0 / 60); + director->setAnimationInterval(1.0 / 60); - auto screenSize = EGLView::getInstance()->getFrameSize(); + auto screenSize = glview->getFrameSize(); auto designSize = Size(480, 320); @@ -41,10 +43,10 @@ bool AppDelegate::applicationDidFinishLaunching() std::vector searchPaths; searchPaths.push_back("hd"); pFileUtils->setSearchPaths(searchPaths); - pDirector->setContentScaleFactor(resourceSize.height/designSize.height); + director->setContentScaleFactor(resourceSize.height/designSize.height); } - EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::FIXED_HEIGHT); + glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::FIXED_HEIGHT); // register lua engine LuaEngine* pEngine = LuaEngine::getInstance(); diff --git a/samples/Lua/TestLua/proj.ios/AppController.mm b/samples/Lua/TestLua/proj.ios/AppController.mm index b7c9a608f0..a572351f25 100644 --- a/samples/Lua/TestLua/proj.ios/AppController.mm +++ b/samples/Lua/TestLua/proj.ios/AppController.mm @@ -24,7 +24,7 @@ #import #import "AppController.h" #import "cocos2d.h" -#import "EAGLView.h" +#import "CCEAGLView.h" #import "AppDelegate.h" #import "RootViewController.h" diff --git a/samples/Lua/TestLua/proj.mac/main.cpp b/samples/Lua/TestLua/proj.mac/main.cpp index 73a7d5f6ae..1814d16c15 100644 --- a/samples/Lua/TestLua/proj.mac/main.cpp +++ b/samples/Lua/TestLua/proj.mac/main.cpp @@ -29,7 +29,5 @@ USING_NS_CC; int main(int argc, char *argv[]) { AppDelegate app; - EGLView eglView; - eglView.init("TestLua",900,640); return Application::getInstance()->run(); }