示例#1
0
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);
}
示例#2
0
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;
}
示例#3
0
int main(int argc, char **argv)
{
    // create the application instance
    AppDelegate app;
    EGLView* eglView = EGLView::getInstance();
    eglView->setFrameSize(960, 640);
    return Application::getInstance()->run();
}
示例#4
0
int main(int argc, char **argv)
{
    // create the application instance
    AppDelegate app;

    EGLView* eglView = EGLView::sharedOpenGLView();
    eglView->setFrameSize(800, 480);

    return Application::sharedApplication()->run();
}
示例#5
0
文件: main.cpp 项目: oraclehan/ruiyou
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();
}
示例#6
0
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(); 
    }
}