void MyQGLWidget::resizeGL(int w, int h) { if (Display::IsRetinaDisplay()) { w >>= 1; h >>= 1; } if (!mLazyInit) { mLazyInit = true; EGLView* view = EGLView::sharedOpenGLView(); view->setFrameSize(w, h); Director* director = Director::sharedDirector(); director->setContentScaleFactor(1); director->setProjection(kDirectorProjection2D); //director->setDisplayStats(true); director->setOpenGLView(view); connect(&mTimer, SIGNAL(timeout()), this, SLOT(updateGL())); mTimer.start(); Scene* scene = Scene::create(); director->pushScene(scene); setMouseTracking(true); } EGLView* view = EGLView::sharedOpenGLView(); view->setFrameSize(w, h); view->setDesignResolutionSize(w, h, kResolutionNoBorder); }
void Enemy::die() { rewardPlayer(); // initialize director Director *pDirector = Director::getInstance(); // create a scene. it's an autorelease object Scene *pScene = VictoryScene::scene(); // run pDirector->pushScene(pScene); //delete player; //delete this; }