本文整理汇总了C++中CCEGLView::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ CCEGLView::Create方法的具体用法?C++ CCEGLView::Create怎么用?C++ CCEGLView::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCEGLView
的用法示例。
在下文中一共展示了CCEGLView::Create方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initInstance
bool AppDelegate::initInstance() {
bool bRet = false;
do {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The HelloWorld is designed as HVGA.
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd
|| ! pMainWnd->Create(TEXT("cocos2d: Hello World"), 480, 320));
#endif // CC_PLATFORM_WIN32
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// OpenGLView initialized in testsAppDelegate.mm on ios platform, nothing need to do here.
#endif // CC_PLATFORM_IOS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// OpenGLView initialized in HelloWorld/android/jni/helloworld/main.cpp
// the default setting is to create a fullscreen view
// if you want to use auto-scale, please enable view->create(320,480) in main.cpp
// if the resources under '/sdcard" or other writeable path, set it.
// warning: the audio source should in assets/
// cocos2d::CCFileUtils::setResourcePath("/sdcard");
#endif // CC_PLATFORM_ANDROID
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WOPHONE)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The HelloWorld is designed as HVGA.
CCEGLView* pMainWnd = new CCEGLView(this);
CC_BREAK_IF(! pMainWnd || ! pMainWnd->Create(320,480, WM_WINDOW_ROTATE_MODE_CW));
#ifndef _TRANZDA_VM_
// on wophone emulator, we copy resources files to Work7/NEWPLUS/TDA_DATA/Data/ folder instead of zip file
cocos2d::CCFileUtils::setResource("HelloWorld.zip");
#endif
#endif // CC_PLATFORM_WOPHONE
#if (CC_TARGET_PLATFORM == CC_PLATFORM_AIRPLAY)
// MaxAksenov said it's NOT a very elegant solution. I agree, haha
CCDirector::sharedDirector()->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The HelloWorld is designed as HVGA.
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd
|| ! pMainWnd->Create("cocos2d: Hello World", 800, 480,480, 320));
CCFileUtils::setResourcePath("../Resource/");
#endif // CC_PLATFORM_LINUX
bRet = true;
} while (0);
return bRet;
}
示例2: CCEGLView
// Creates and restores Cocos2d-x after DirectX and Angle contexts are created or updated
void Cocos2dRenderer::CreateGLResources()
{
if(!mInitialized)
{
mInitialized = true;
CCEGLView* pEGLView = new CCEGLView();
pEGLView->Create(m_eglDisplay, m_eglContext, m_eglSurface, m_renderTargetSize.Width, m_renderTargetSize.Height);
pEGLView->setViewName("Cocos2d-x");
CCApplication::sharedApplication()->run();
pEGLView->SetXamlEventDelegate(m_delegate);
pEGLView->SetXamlMessageBoxDelegate(m_messageBoxDelegate);
pEGLView->SetXamlEditBoxDelegate(m_editBoxDelegate);
}
else
{
ccGLInvalidateStateCache();
CCShaderCache::sharedShaderCache()->reloadDefaultShaders();
ccDrawInit();
CCTextureCache::sharedTextureCache()->reloadAllTextures();
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVENT_COME_TO_FOREGROUND, NULL);
CCDirector::sharedDirector()->setGLDefaultValues();
CCDirector::sharedDirector()->resume();
}
m_loadingComplete = true;
}
示例3: CCEGLView
MainPage::MainPage()
{
InitializeComponent();
PTModelController *mc = PTModelController::shared();
mc->clean();
mc->loadDataForClass( CCString::create("data/PTModelGeneralSettings.0.attributes.xml"), PTModelControllerDataTypeAttributes );
mc->loadDataForClass( CCString::create("data/PTModelFont.0.attributes.xml"), PTModelControllerDataTypeAttributes );
mc->loadDataForClass( CCString::create("data/PTModelScreen.0.attributes.xml"), PTModelControllerDataTypeAttributes );
mc->loadDataForClass( CCString::create("data/PTModelObjectLabel.0.attributes.xml"), PTModelControllerDataTypeAttributes );
mc->loadDataForClass( CCString::create("data/PTModelScreen.0.connections.xml"), PTModelControllerDataTypeConnections );
std::vector<std::string> searchPath;
searchPath.push_back("data");
searchPath.push_back("data/atlases");
searchPath.push_back("data/fonts");
searchPath.push_back("data/images");
searchPath.push_back("data/sounds");
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
CCEGLView* eglView = new CCEGLView();
eglView->Create(Window::Current->CoreWindow, SwapChainPanel);
eglView->setViewName("Player");
mc->clean();
CCApplication::sharedApplication()->run();
KeyUp += ref new Windows::UI::Xaml::Input::KeyEventHandler(this, &MainPage::OnKeyUp);
KeyDown += ref new Windows::UI::Xaml::Input::KeyEventHandler(this, &MainPage::OnKeyDown);
}
示例4: initInstance
virtual bool initInstance(){
CCEGLView * pMainWnd = new CCEGLView();
pMainWnd->Create(1024, 600);
CCFileUtils::setResourcePath("app/native/Resources");
PyObject* self = (PyObject*)app;
PyObject* ret=PyObject_CallMethod(self, "initInstance", NULL);
return PyInt_AsLong(ret) ;
}
示例5: initInstance
bool AppDelegate::initInstance()
{
bool bRet = false;
do
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The tests is designed as HVGA.
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd
|| ! pMainWnd->Create(TEXT("cocos2d: tests"), 480, 320));
#endif // CC_PLATFORM_WIN32
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// OpenGLView initialized in testsAppDelegate.mm on ios platform, nothing need to do here.
#endif // CC_PLATFORM_IOS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Android doesn't need to do anything.
#endif // CC_PLATFORM_ANDROID
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WOPHONE)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The tests is designed as HVGA.
CCEGLView* pMainWnd = new CCEGLView(this);
CC_BREAK_IF(! pMainWnd || ! pMainWnd->Create(320 ,480, WM_WINDOW_ROTATE_MODE_CW));
#ifndef _TRANZDA_VM_
// on wophone emulator, we copy resources files to Work7/NEWPLUS/TDA_DATA/Data folder instead of zip file
cocos2d::CCFileUtils::setResource("TestCocos2dx.zip");
CocosDenshion::SimpleAudioEngine::setResource("TestCocos2dx.zip");
#endif
#endif
bRet = true;
} while (0);
return bRet;
}
示例6: initInstance
bool AppDelegate::initInstance()
{
bool bRet = false;
do
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The HelloWorld is designed as HVGA.
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd
|| ! pMainWnd->Create(TEXT("Cocos2dxSimpleGameForWin32"), 320, 480));
#endif // CC_PLATFORM_WIN32
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// OpenGLView initialized in testsAppDelegate.mm on ios platform, nothing need to do here.
#endif // CC_PLATFORM_IOS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Android doesn't need to do anything.
#endif // CC_PLATFORM_ANDROID
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WOPHONE)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The HelloWorld is designed as HVGA.
// Use GetScreenWidth() and GetScreenHeight() get screen width and height.
CCEGLView * pMainWnd = new CCEGLView(this);
CC_BREAK_IF(! pMainWnd
|| ! pMainWnd->Create(320, 480));
#if !defined(_TRANZDA_VM_)
// set the resource zip file
// on wophone emulator, we copy resources files to Work7/TG3/APP/ folder instead of zip file
CCFileUtils::setResource("Cocos2dxSimpleGameForWin32.zip");
#endif
#endif // CC_PLATFORM_WOPHONE
bRet = true;
} while (0);
return bRet;
}
示例7: CCEGLView
MainPage::MainPage()
{
InitializeComponent();
CCEGLView* eglView = new CCEGLView();
eglView->Create(Window::Current->CoreWindow, SwapChainPanel);
eglView->setViewName("OzgGameRPG");
CCApplication::sharedApplication()->run();
}
示例8: initInstance
bool AppDelegate::initInstance()
{
bool bRet = false;
do
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The HelloWorld is designed as HVGA.
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd
|| ! pMainWnd->Create(TEXT("cocos2d: Hello World"), 320, 480));
#endif // CC_PLATFORM_WIN32
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// OpenGLView initialized in testsAppDelegate.mm on ios platform, nothing need to do here.
#endif // CC_PLATFORM_IOS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// android does not do anything
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WOPHONE)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The HelloWorld is designed as HVGA.
CCEGLView* pMainWnd = new CCEGLView(this);
CC_BREAK_IF(! pMainWnd || ! pMainWnd->Create(320,480));
#ifndef _TRANZDA_VM_
// on wophone emulator, we copy resources files to Work7/TG3/APP/ folder instead of zip file
cocos2d::CCFileUtils::setResource("HelloWorld.zip");
#endif
#endif // CC_PLATFORM_WOPHONE
bRet = true;
} while (0);
return bRet;
}
示例9: CCEGLView
bool Ag2dEngine::init()
{
bool bRet = false;
do
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd || ! pMainWnd->Create(TEXT(APP_TITLE), CONF_WND_WIDTH, CONF_WND_HEIGHT));
#endif
bRet = true;
} while (0);
return bRet;
}
示例10: initInstance
bool AppDelegate::initInstance()
{
bool bRet = false;
do
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN8_METRO)
void* buff=_aligned_malloc(sizeof(CCEGLView),16);
CCEGLView* mainView = new (buff) CCEGLView();
mainView->Create();
//mainView->Create();
//mainView->setDesignResolution(480, 320);
//mainView->setDesignResolution(640, 1066);
CCLOG("Device Res:%d", m_deviceResolutionInPixels);
switch (m_deviceResolutionInPixels)
{
case DeviceResolutionInPixels_WVGA:
{
mainView->setDesignResolution(480, 800);
mainView->setFrameSize(800,480);
break;
}
case DeviceResolutionInPixels_720p:
{
mainView->setDesignResolution(720, 1280);
mainView->setFrameSize(1280,720);
break;
}
case DeviceResolutionInPixels_WXGA:
{
mainView->setDesignResolution(768, 1280);
mainView->setFrameSize(1280,768);
break;
}
}
#endif // CC_PLATFORM_WIN8_METRO
bRet = true;
} while (0);
return bRet;
}
示例11: initInstance
bool AppDelegate::initInstance()
{
bool bRet = false;
do
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN8_METRO)
// fix bug: 16bit aligned
void* buff=_aligned_malloc(sizeof(CCEGLView),16);
CCEGLView* mainView = new (buff) CCEGLView();
mainView->Create();
mainView->setDesignResolution(480, 320);
#endif // CC_PLATFORM_WIN8_METRO
bRet = true;
} while (0);
return bRet;
}
示例12: initInstance
bool AppDelegate::initInstance()
{
bool bRet = false;
do
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd
|| ! pMainWnd->Create(TEXT("Component Communicator"), 768, 1024));
#endif // CC_PLATFORM_WIN32
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
CCFileUtils::setiPadSuffix("");
#endif // CC_PLATFORM_IOS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#endif // CC_PLATFORM_ANDROID
bRet = true;
} while (0);
return bRet;
}
示例13: initInstance
bool AppDelegate::initInstance()
{
bool bRet = false;
do
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN8_METRO)
// fix bug: 16bit aligned
void* buff=_aligned_malloc(sizeof(CCEGLView),16);
CCEGLView* mainView = new (buff) CCEGLView();
mainView->Create();
mainView->setDesignResolution(800, 480);
#endif // CC_PLATFORM_WIN8_METRO
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The tests is designed as HVGA.
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd
|| ! pMainWnd->Create(TEXT("cocos2d: tests"), 480, 320));
#endif // CC_PLATFORM_WIN32
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
// OpenGLView initialized in testsAppDelegate.mm on ios platform, nothing need to do here.
#endif // CC_PLATFORM_IOS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// Android doesn't need to do anything.
#endif // CC_PLATFORM_ANDROID
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WOPHONE)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The tests is designed as HVGA.
CCEGLView* pMainWnd = new CCEGLView(this);
CC_BREAK_IF(! pMainWnd || ! pMainWnd->Create(320 ,480, WM_WINDOW_ROTATE_MODE_CW));
#ifndef _TRANZDA_VM_
// on wophone emulator, we copy resources files to Work7/NEWPLUS/TDA_DATA/Data folder instead of zip file
cocos2d::CCFileUtils::setResource("TestCocos2dx.zip");
CocosDenshion::SimpleAudioEngine::setResource("TestCocos2dx.zip");
#endif
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
CCDirector::sharedDirector()->setDeviceOrientation(CCDeviceOrientationLandscapeLeft);
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
// Initialize OpenGLView instance, that release by CCDirector when application terminate.
// The HelloWorld is designed as HVGA.
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd
|| ! pMainWnd->Create("cocos2d: tests", 480, 320, 480, 320));
//set the base resource folder pay attention to add "/"
CCFileUtils::setResourcePath("../Res/");
#endif // CC_PLATFORM_LINUX
#if (CC_TARGET_PLATFORM == CC_PLATFORM_BADA)
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd|| ! pMainWnd->Create(this, 480, 320));
pMainWnd->setDeviceOrientation(Osp::Ui::ORIENTATION_LANDSCAPE);
CCFileUtils::setResourcePath("/Res/");
#endif // CC_PLATFORM_BADA
#if (CC_TARGET_PLATFORM == CC_PLATFORM_QNX)
CCEGLView * pMainWnd = new CCEGLView();
CC_BREAK_IF(! pMainWnd|| ! pMainWnd->Create(480, 320));
CCFileUtils::setResourcePath("app/native/Resource");
#endif // CC_PLATFORM_QNX
bRet = true;
} while (0);
return bRet;
}