当前位置: 首页>>代码示例>>C++>>正文


C++ EGLView类代码示例

本文整理汇总了C++中EGLView的典型用法代码示例。如果您正苦于以下问题:C++ EGLView类的具体用法?C++ EGLView怎么用?C++ EGLView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了EGLView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    AppDelegate app;
    EGLView eglView;
    eglView.init("MoonWarriors", 480, 720);
    return Application::getInstance()->run();
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:7,代码来源:main.cpp

示例2: connect

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);
}
开发者ID:UIKit0,项目名称:ccgraphedit,代码行数:34,代码来源:myqglwidget.cpp

示例3: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    Director* director = Director::getInstance();
    EGLView* eglView = EGLView::getInstance();

    // チラツキ対策
//    Director::getInstance()->setProjection(Director::Projection::_2D);
    Director::getInstance()->setDepthTest(false);
  
    Director::getInstance()->setOpenGLView(eglView);
	
    // 800x480基準
    eglView->setDesignResolutionSize(800.0 * 0.6,
                                     480.0 * 0.6,
                                     ResolutionPolicy::SHOW_ALL);
    
    // turn on display FPS
    director->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    director->setAnimationInterval(1.0 / 60);

    // create a scene. it's an autorelease object
//    Scene *pScene = GameScene::scene();
    auto *pScene = TitleSceneLoader::createScene();

    // run
    director->runWithScene(pScene);

    return true;
}
开发者ID:ezhong0812,项目名称:Cocos2dxSRPGQuest,代码行数:31,代码来源:AppDelegate.cpp

示例4: main

int main(int argc, char *argv[])
{
    AppDelegate app;
    EGLView eglView;
    eglView.init("Hello World",900,640);
    return Application::getInstance()->run();
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:7,代码来源:main.cpp

示例5: _tWinMain

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;
}
开发者ID:CBanDa,项目名称:cocos2d-x-3.0alpha0-pre,代码行数:29,代码来源:main.cpp

示例6: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    Director* director = Director::getInstance();
    EGLView* glView = EGLView::getInstance();

    director->setOpenGLView(glView);
    
    Size size = director->getWinSize();

	setDesignResolution();

    // Set the design resolution
	glView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
	
    // turn on display FPS
    //director->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    director->setAnimationInterval(1.0 / 60);

    // create a scene. it's an autorelease object
#if(CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
	Scene *scene = MainTitleScene::create();
#else
    Scene *scene = HelloWorld::scene();
#endif
    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:rtothecore,项目名称:GrandBlue,代码行数:31,代码来源:AppDelegate.cpp

示例7: setDesignResolution

void AppDelegate::setDesignResolution()
{
	Director* director = Director::getInstance();
	EGLView* glView = EGLView::getInstance();

	Size frameSize = glView->getFrameSize();  
	vector<string> searchPath;

#if(CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
	if (frameSize.height > small5Resource.size.height)
	{
		log("ipadhd resource selected");

		designResolutionSize = largeResource.size;
		searchPath.push_back(largeResource.directory);
		director->setContentScaleFactor(MIN(largeResource.size.height/designResolutionSize.height, largeResource.size.width/designResolutionSize.width));
	}
	else if (frameSize.height > mediumResource.size.height)
	{
		log("iphone5 resource selected");

		designResolutionSize = small5Resource.size;
		searchPath.push_back(small5Resource.directory);
		director->setContentScaleFactor(MIN(small5Resource.size.height/designResolutionSize.height, small5Resource.size.width/designResolutionSize.width));
	}
	else if (frameSize.height > smallResource.size.height)
	{
		log("ipad resource selected");

		designResolutionSize = mediumResource.size;
		searchPath.push_back(mediumResource.directory);
		director->setContentScaleFactor(MIN(mediumResource.size.height/designResolutionSize.height, mediumResource.size.width/designResolutionSize.width));
	}
	else if (frameSize.height > small3Resource.size.height)
	{
		log("iphone resource selected");

		designResolutionSize = smallResource.size;
		searchPath.push_back(smallResource.directory);
		director->setContentScaleFactor(MIN(smallResource.size.height/designResolutionSize.height, smallResource.size.width/designResolutionSize.width));
	}
	else
	{
		log("iphone3 resource selected");

		designResolutionSize = small3Resource.size;
		searchPath.push_back(small3Resource.directory);
		director->setContentScaleFactor(MIN(small3Resource.size.height/designResolutionSize.height, small3Resource.size.width/designResolutionSize.width));
	}
#else
	log("android resource selected");

	designResolutionSize = androidResource.size;
	searchPath.push_back(androidResource.directory);
	director->setContentScaleFactor(MIN(androidResource.size.height/designResolutionSize.height, androidResource.size.width/designResolutionSize.width));
#endif

	// set searching path
	FileUtils::getInstance()->setSearchPaths(searchPath);
}
开发者ID:rtothecore,项目名称:GrandBlue,代码行数:60,代码来源:AppDelegate.cpp

示例8: _tWinMain

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.init("OpenBird - Ge Ziyang", 450, 800);

    int ret = Application::getInstance()->run();

#ifdef USE_WIN32_CONSOLE
    FreeConsole();
#endif

    return ret;
}
开发者ID:7thpark,项目名称:OpenBird,代码行数:28,代码来源:main.cpp

示例9: main

int main(int argc, char **argv)
{
    // create the application instance
    AppDelegate app;
    EGLView* eglView = EGLView::getInstance();
    eglView->setFrameSize(960, 640);
    return Application::getInstance()->run();
}
开发者ID:CBanDa,项目名称:cocos2d-x-3.0alpha0-pre,代码行数:8,代码来源:main.cpp

示例10: main

int main(int argc, char **argv)
{
    // create the application instance
    AppDelegate app;
    EGLView eglView;
    eglView.init("HelloCpp",900,640);
    return Application::getInstance()->run();
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:8,代码来源:main.cpp

示例11: main

int main(int argc, char **argv)
{
    // create the application instance
    AppDelegate app;
    EGLView eglView;
    eglView.init("Cocos2d-x Game Using LUA",288 * 2, 512 * 2);
    return Application::getInstance()->run();
}
开发者ID:Cocos2d-x-vn,项目名称:OpenBird,代码行数:8,代码来源:main.cpp

示例12: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    Director* pDirector = Director::sharedDirector();
    EGLView* pEGLView = EGLView::sharedOpenGLView();

    pDirector->setOpenGLView(pEGLView);

    // Set the design resolution
    pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);

	Size frameSize = pEGLView->getFrameSize();
    
    vector<string> searchPath;

    // In this demo, we select resource according to the frame's height.
    // If the resource size is different from design resolution size, you need to set contentScaleFactor.
    // We use the ratio of resource's height to the height of design resolution,
    // this can make sure that the resource's height could fit for the height of design resolution.

    // if the frame's height is larger than the height of medium resource size, select large resource.
	if (frameSize.height > mediumResource.size.height)
	{
        searchPath.push_back(largeResource.directory);

        pDirector->setContentScaleFactor(MIN(largeResource.size.height/designResolutionSize.height, largeResource.size.width/designResolutionSize.width));
	}
    // if the frame's height is larger than the height of small resource size, select medium resource.
    else if (frameSize.height > smallResource.size.height)
    {
        searchPath.push_back(mediumResource.directory);
        
        pDirector->setContentScaleFactor(MIN(mediumResource.size.height/designResolutionSize.height, mediumResource.size.width/designResolutionSize.width));
    }
    // if the frame's height is smaller than the height of medium resource size, select small resource.
	else
    {
        searchPath.push_back(smallResource.directory);

        pDirector->setContentScaleFactor(MIN(smallResource.size.height/designResolutionSize.height, smallResource.size.width/designResolutionSize.width));
    }
    
    // set searching path
    FileUtils::sharedFileUtils()->setSearchPaths(searchPath);
	
    // turn on display FPS
    pDirector->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    pDirector->setAnimationInterval(1.0 / 60);

    // create a scene. it's an autorelease object
    Scene *pScene = HelloWorld::scene();

    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:bassarisse,项目名称:LostInCaves,代码行数:58,代码来源:AppDelegate.cpp

示例13: main

int main(int argc, char **argv)
{
    // create the application instance
    AppDelegate app;
    EGLView eglView;
    eglView.init("TestCPP",240, 320);
    Application::getInstance()->setAnimationInterval(1.0f/60.0f);
    return Application::getInstance()->run();
}
开发者ID:PICHURRIAJUEGOS-,项目名称:moreneuron,代码行数:9,代码来源:main.cpp

示例14: main

int main(int argc, char **argv)
{
    // create the application instance
    AppDelegate app;

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

    return Application::sharedApplication()->run();
}
开发者ID:bassarisse,项目名称:LostInCaves,代码行数:10,代码来源:main.cpp

示例15: motionCB

extern "C" void motionCB(int x, int y)
{
    float fx = x;
    float fy = y;
    EGLView* pEGLView = EGLView::getInstance();
    int id = 0;

    if(buttonDepressed)
    {
        pEGLView->handleTouchesMove(1, &id, &fx, &fy);
    }
}
开发者ID:Gamex,项目名称:GameX,代码行数:12,代码来源:CCEGLView.cpp


注:本文中的EGLView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。