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); }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); #ifdef USE_WIN32_CONSOLE AllocConsole(); freopen("CONIN$", "r", stdin); freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stderr); #endif // create the application instance AppDelegate app; EGLView* eglView = EGLView::getInstance(); eglView->setViewName("MoonWarriors"); eglView->setFrameSize(320, 480); int ret = Application::getInstance()->run(); #ifdef USE_WIN32_CONSOLE FreeConsole(); #endif return ret; }
int main(int argc, char **argv) { // create the application instance AppDelegate app; EGLView* eglView = EGLView::getInstance(); eglView->setFrameSize(960, 640); return Application::getInstance()->run(); }
int main(int argc, char **argv) { // create the application instance AppDelegate app; EGLView* eglView = EGLView::sharedOpenGLView(); eglView->setFrameSize(800, 480); return Application::sharedApplication()->run(); }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); // create the application instance AppDelegate app; EGLView* eglView = EGLView::getInstance(); eglView->setViewName("testcard"); eglView->setFrameSize(1136, 640); return Application::getInstance()->run(); }
void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h) { if (!Director::getInstance()->getOpenGLView()) { EGLView *view = EGLView::getInstance(); view->setFrameSize(w, h); AppDelegate *pAppDelegate = new AppDelegate(); Application::getInstance()->run(); } else { GL::invalidateStateCache(); ShaderCache::getInstance()->reloadDefaultShaders(); DrawPrimitives::init(); TextureCache::reloadAllTextures(); NotificationCenter::getInstance()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); Director::getInstance()->setGLDefaultValues(); } }