本文整理汇总了C++中CCEGLView::setDesignResolutionSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CCEGLView::setDesignResolutionSize方法的具体用法?C++ CCEGLView::setDesignResolutionSize怎么用?C++ CCEGLView::setDesignResolutionSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCEGLView
的用法示例。
在下文中一共展示了CCEGLView::setDesignResolutionSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
pEGLView->setDesignResolutionSize(Setting::g_ResolusionWidth,Setting::g_ResolusionHeight,kResolutionExactFit);
CCEGLView *pView = CCEGLView::sharedOpenGLView();
pView->setDesignResolutionSize(Setting::g_ResolusionWidth,Setting::g_ResolusionHeight,kResolutionExactFit);
// 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
// SceneManager::goPlay(kSceneTagMain);
CCScene *pscene = CCScene::create();
logo *pLayer = logo::create();
pscene->addChild(pLayer);
pDirector->runWithScene(pscene);
return true;
}
示例2: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
CCSize frameSize = pEGLView->getFrameSize();
CCLOG("ScreenSize width:%f, height:%f", frameSize.width, frameSize.height);
#if (SCREEN_ORIENTATION == SCREEN_ORIENTATION_LANDSCAPE) // 横屏
float frameScale = frameSize.width/frameSize.height;
#elif (SCREEN_ORIENTATION == SCREEN_ORIENTATION_PORTRAIT) // 竖屏
float frameScale = frameSize.height/frameSize.width;
#else
#error unknown target ORIENTATION!
#endif
if( frameScale < 3.0f/2.0f ) // 窄屏,屏幕宽度:高度小于3:2
{
// Set the design resolution
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionShowAll);
}
else
{
// Set the design resolution
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
}
//use fixed resource
float fScale = MIN(designResolutionRes.size.width/designResolutionSize.width, designResolutionRes.size.height/designResolutionSize.height);
// CCFileUtils::sharedFileUtils()->setResourceDirectory(designResolutionRes.directory);
pDirector->setContentScaleFactor(fScale);
CCLOG("setContentScaleFactor fscale: %f, res.size(%f, %f), deSize(%f, %f)", fScale, designResolutionRes.size.width, designResolutionRes.size.height, designResolutionSize.width, designResolutionSize.height);
// turn on display FPS lyp 取消帧率
//pDirector->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this lyp 取消帧率
//pDirector->setAnimationInterval(1.0 / 50);
// create a scene. it's an autorelease object
// CCScene* pScene = CSceneInit::scene();
// CCScene* pScene = SceneLogo::scene();
CCLOG("GO TO LOGIN");
CCScene* pScene = LoadingScene::scene(TargetSceneLoginScene);
// run
pDirector->runWithScene(pScene);
return true;
}
示例3: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
//!< 화면의 실제 크기를 나타냅니다
//!< [화면 모니터 크기가 아닌 화면 해상도같은 크기]
//!< [모니터 크기는 고정인데 해상도는 들쭉날쭉하죠]
//!< [main.cpp의 해상도가 모니터 크기, 요기에 있는게 해상도 크기]
pEGLView->setDesignResolutionSize(768, 1024, kResolutionExactFit);
// 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
CCScene *pScene = HelloWorld::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
示例4: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
//setOrientation(kOrientationLandscapeLeft);
//CCEGLView::sharedOpenGLView().setDesignResolutionSize(800.0, 480.0);
pDirector->setOpenGLView(pEGLView);
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
//pDirector->enableRetinaDisplay(true);
pEGLView->setDesignResolutionSize(800,480, kResolutionShowAll);
// turn on display FPS
pDirector->setDisplayStats(false);
// 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
CCScene *pScene = WelcomeView::CreateScene();
// run
pDirector->runWithScene(pScene);
return true;
}
示例5: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
// 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);
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pEGLView->setDesignResolutionSize(480, 320, kResolutionShowAll);
// create a scene. it's an autorelease object
//CCScene *pScene = HelloWorld::scene();
// CCScene* pScene = GameScene::scene();
CCScene* pScene = FirstScene::scene();
//CCScene* pScene = MainGameScene::scene();
//CCScene* pScene = Particle::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
示例6: AppDelegate
void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h)
{
if (!CCDirector::sharedDirector()->getOpenGLView())
{
CCEGLView *view = CCEGLView::sharedOpenGLView();
view->setFrameSize(w, h);
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(view);
// set the design resolution screen size, if you want to use Design Resoulution scaled to current screen, please uncomment next line.
view->setDesignResolutionSize(SCREEN_SIZE_WIDTH, SCREEN_SIZE_HEIGHT, /*kResolutionShowAll*/kResolutionExactFit);
AppDelegate *pAppDelegate = new AppDelegate();
CCApplication::sharedApplication()->run();
}
else
{
ccDrawInit();
ccGLInvalidateStateCache();
CCShaderCache::sharedShaderCache()->reloadDefaultShaders();
CCTextureCache::reloadAllTextures();
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
CCDirector::sharedDirector()->setGLDefaultValues();
}
}
示例7: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
CCSize framSize = pEGLView->getFrameSize();
CCFileUtils::sharedFileUtils()->setResourceDirectory(hongMiResource.directory);
CCString mm;
mm = CCFileUtils::sharedFileUtils()->getResourceDirectory();
CCLOG("curent URL: %s", mm);
pDirector->setContentScaleFactor(hongMiResource.size.width/designResolutionSize.width);
// 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
CCScene *pScene = new LoadingScene();//TestLayer::scene();//
// run
pDirector->runWithScene(pScene);
return true;
}
示例8: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pEGLView->setFrameSize(480, 800);
pDirector->setOpenGLView(pEGLView);
// 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
CCScene *pScene = GameScene::create();
pEGLView->setDesignResolutionSize(480, 800, kResolutionExactFit);
// run
pDirector->runWithScene(pScene);
return true;
}
示例9: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
// デザインサイズの設定
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
CCSize frameSize = pEGLView->getFrameSize();
std::vector<std::string> searchPath;
if (frameSize.height > largeResource.size.height)
{
// iPad Retina用リソースを使用
searchPath.push_back(xlargeResource.directory);
pDirector->setContentScaleFactor(MIN(xlargeResource.size.height / designResolutionSize.height, xlargeResource.size.width / designResolutionSize.width));
}
else if (frameSize.height > smallResource.size.height)
{
// iPad用リソースを使用
searchPath.push_back(largeResource.directory);
pDirector->setContentScaleFactor(MIN(largeResource.size.height / designResolutionSize.height, largeResource.size.width / designResolutionSize.width));
}
else
{
// iPhone用リソースを使用
searchPath.push_back(smallResource.directory);
pDirector->setContentScaleFactor(MIN(smallResource.size.height / designResolutionSize.height, smallResource.size.width / designResolutionSize.width));
}
// リソースディレクトリを指定
CCFileUtils::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);
// CocosBuilderのファイルを読み込みゲーム画面を生成する
CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
ccNodeLoaderLibrary->registerCCNodeLoader("GameLayer", GameLayerLoader::loader());
CCBReader* ccbReader = new CCBReader(ccNodeLoaderLibrary);
CCNode* node = ccbReader->readNodeGraphFromFile("GameLayer.ccbi");
((GameLayer*)node)->setAnimationManager(ccbReader->getAnimationManager());
// シーンを用意し、ゲーム画面を設置する
CCScene* pScene = CCScene::create();
if (node != NULL)
pScene->addChild(node);
ccbReader->release();
// run
pDirector->runWithScene(pScene);
return true;
}
示例10: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
srand(time(NULL));
pDirector->setOpenGLView(pEGLView);
// Set the design resolution
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
CCSize 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
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
// turn on display FPS
pDirector->setDisplayStats(false);
// 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
CCScene *pScene = TicTacToeScene::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
示例11: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
pEGLView->setDesignResolutionSize(960,640,kResolutionExactFit);
// turn on display FPS
pDirector->setDisplayStats(false);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 25);
//init resources
ResourceManager::inits();
// create a scene. it's an autorelease object
//CCScene *pScene = GameScene::create();
//CCLayer *pLayer = GameLayer::create();
//CCSize winSize = pDirector->getWinSize();
//CCSize layerSize = pLayer->getContentSize();
//pLayer->setPosition(ccp(winSize.width / 2 - layerSize.width / 2,winSize.height / 2 - layerSize.height / 2));
//pScene->addChild(pLayer);
// run
CocosDenshion::SimpleAudioEngine::sharedEngine()->playBackgroundMusic("sound/bg.mid", true);
pDirector->runWithScene(LoadingScene::scene());
return true;
}
示例12: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
soundEnable = true;
effectEnable = true;
// SpriteFrameCache::getInstance()->addSpriteFramesWithFile("MainMenu0.plist");
// initialize director
CCDirector* director = CCDirector::sharedDirector();
CCEGLView* eglView = CCEGLView::sharedOpenGLView();
director->setOpenGLView(eglView);
eglView->setDesignResolutionSize(320, 480, kResolutionShowAll);
// 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
//auto scene = HelloWorld::createScene();
MainMenuController* scene = MainMenuController::create();
//auto scene = GameRunController::create();
//auto scene = AtlasSplit::createScene();
// run
director->runWithScene(scene);
// UIWidget* playGroundUI = cocos2d::extension::UIHelper::instance()->createWidgetFromJsonFile("PlayGroundUI.ExportJson");
//reloadSound();
return true;
}
示例13: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
CCEGLView* pEglView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEglView);
// 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);
pEglView->setDesignResolutionSize(SCREEN_WIDTH, SCREEN_HEIGHT, kResolutionNoBorder);
std::vector<std::string> vectorSearchPaths;
vectorSearchPaths.push_back("iphonehd");
CCFileUtils::sharedFileUtils()->setSearchPaths(vectorSearchPaths);
// create a scene. it's an autorelease object
CCScene *pScene = GameScene::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
示例14: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
std::vector<std::string> searchPath;
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView( pEGLView );
// Set the design resolution
pEGLView->setDesignResolutionSize( designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder );
// turn on display FPS
pDirector->setDisplayStats(false);
// 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
CCScene *pScene = DefaultScene::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
示例15: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
//pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
//set ScaleFactor
pDirector->setContentScaleFactor( 640 / designResolutionSize.width);
// 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);
// register lua engine
//CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
//CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
//std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
//pEngine->executeScriptFile(path.c_str());
View::_gamemanager::instance()->DisplayNowScene(View::SCENE_INIT);
return true;
}