本文整理汇总了C++中CCEGLView类的典型用法代码示例。如果您正苦于以下问题:C++ CCEGLView类的具体用法?C++ CCEGLView怎么用?C++ CCEGLView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCEGLView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tWinMain
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// create the application instance
AppDelegate app;
CCEGLView* eglView = CCEGLView::sharedOpenGLView();
eglView->setViewName("testGame");
eglView->setFrameSize(600, 400);
return CCApplication::sharedApplication()->run();
}
示例2: detachWithIME
bool CATextField::detachWithIME()
{
bool bRet = CAIMEDelegate::detachWithIME();
if (bRet)
{
// close keyboard
CCEGLView * pGlView = CAApplication::getApplication()->getOpenGLView();
if (pGlView)
{
pGlView->setIMEKeyboardState(false);
}
}
return bRet;
}
示例3: CCEGLView
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 is initialized in AppDelegate.mm on ios platform, nothing need to do here.
#endif // CC_PLATFORM_IOS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
// OpenGLView is 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
#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/TG3/APP/ 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
bRet = true;
} while (0);
return bRet;
}
示例4: _tWinMain
//-------------------------------------------------------------------------
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
AppDelegate app;
CCEGLView* eglView = CCEGLView::sharedOpenGLView();
eglView->setViewName(A2U("FKImageTool图片格式转译&查看工具").c_str());
eglView->setFrameSize(1624, 1024);
eglView->setFrameZoomFactor(0.8f);
return CCApplication::sharedApplication()->run();
}
示例5: _tWinMain
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// create the application instance
AppDelegate app;
CCEGLView* eglView = CCEGLView::sharedOpenGLView();
eglView->setViewName("MiniGame");
eglView->setFrameSize(SCREEN_WIDTH, SCREEN_HEIGHT);
eglView->setFrameZoomFactor(0.5);
return CCApplication::sharedApplication()->run();
}
示例6: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
AdUtil::init();
GameConfig::init();
// initialize director
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
pEGLView->setDesignResolutionSize(480, 800, kResolutionExactFit);
// pDirector->setDisplayStats(true);
pDirector->setAnimationInterval(1.0 / 60);
CCScene *pScene = HomeScene::scene();
pDirector->runWithScene(pScene);
srand(time(NULL));
return true;
}
示例7: insertText
void CATextView::setText(const std::string& var)
{
CATextViewDelegate* pTemp = m_pTextViewDelegate;
m_pTextViewDelegate = NULL;
m_szText.clear();
m_iCurPos = 0;
m_vLinesTextView.clear();
m_curSelCharRange = std::make_pair(0, 0);
insertText(var.c_str(), (int)var.length());
m_pTextViewDelegate = pTemp;
m_bUpdateImage = true;
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
CCEGLView * pGlView = CAApplication::getApplication()->getOpenGLView();
pGlView->setIMECursorPos(getCursorPos(), getContentText());
#endif
}
示例8: _tWinMain
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// create the application instance
AppDelegate app;
CCEGLView* eglView = CCEGLView::sharedOpenGLView();
eglView->setViewName("MyPompaDroid");
eglView->setFrameSize(480, 320);
eglView->setWndProc(myWndProcHook);
return CCApplication::sharedApplication()->run();
}
示例9: _tWinMain
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
//ParseJsonFromString();
#ifdef WIN32
ICrashDump* pDumpSys = nullptr;
HRESULT hr = CoTsCreateInstance(CRASH_DUMP_LIBRARY,ICrashDumpGUID,(void**)&pDumpSys);
pDumpSys->Initialize(SCENE_CRASH_DUMP);
#endif
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
#ifdef USE_WIN32_CONSOLE
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
#endif
//std::string s = "000$^aaa^$2a000$^bbb^$2a000$^ccc^$2a000$^ddd^$2a";
//std::regex re("\\$\\^.*?\\^\\$");
//std::sregex_token_iterator i(s.begin(), s.end(), re);
//std::sregex_token_iterator j;
//unsigned count = 0;
//while(i != j)
//{
// cout << *i++ << endl;
// count++;
//}
// create the application instance
AppDelegate app;
CCEGLView* eglView = CCEGLView::sharedOpenGLView();
eglView->setFrameSize(640/2, 1136/2);
int ret = CCApplication::sharedApplication()->run();
#ifdef USE_WIN32_CONSOLE
FreeConsole();
#endif
return ret;
}
示例10: applicationDidFinishLaunching
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
pDirector->setOpenGLView(pEGLView);
// Set the design resolution
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionExactFit);
CCSize frameSize = pEGLView->getFrameSize();
std::vector<std::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.
float scaleFactor = 1.0f;
if (frameSize.height > mediumResource.size.height) {
searchPath.push_back(largeResource.directory);
scaleFactor = 4.0f;
}
// 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);
scaleFactor = 2.0f;
}
// if the frame's height is smaller than the height of medium resource size, select small resource.
else {
searchPath.push_back(smallResource.directory);
scaleFactor = 1.0f;
}
pDirector->setContentScaleFactor(scaleFactor);
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
// Init Nextpeer
this->initializeNextpeer();
// run
pDirector->runWithScene(MainMenuScene::scene());
return true;
}
示例11: _tWinMain
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// create the application instance
AppDelegate app;
CCEGLView* eglView = CCEGLView::sharedOpenGLView();
eglView->setFrameSize(480, 320);
// The resolution of ipad3 is very large. In general, PC's resolution is smaller than it.
// So we need to invoke 'setFrameZoomFactor'(only valid on desktop(win32, mac, linux)) to make the window smaller.
//eglView->setFrameZoomFactor(0.4f);
return CCApplication::sharedApplication()->run();
}
示例12: detachWithIME
bool CCTextFieldTTF::detachWithIME()
{
this->unschedule(schedule_selector(CCTextFieldTTF::blick));
//std::string sText(m_pInputText->c_str());
CCLabelTTF::setString(m_pInputText->c_str());
bool bRet = CCIMEDelegate::detachWithIME();
if (bRet)
{
// close keyboard
CCEGLView * pGlView = CCDirector::sharedDirector()->getOpenGLView();
if (pGlView)
{
pGlView->setIMEKeyboardState(false);
}
}
return bRet;
}
示例13: main
int main(int argc, char **argv)
{
// create the application instance
// CCDirector* pDirector = CCDirector::sharedDirector();
//
// pDirector->setOpenGLView(pEGLView);
//pEGLView->setDesignResolutionSize(768.0f, 1280.0f, kResolutionShowAll);
AppDelegate app;
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
/*iphone5*/
//pEGLView->setFrameSize(640.0f, 1136.0f);
pEGLView->setFrameSize(480.0f, 852.0f);
/*ipad*/
//pEGLView->setFrameSize(1536.0f, 2048.0f);
//pEGLView->setFrameSize(512.0f, 682.67f);
return CCApplication::sharedApplication()->run();
}
示例14: 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);
//
CCSize frameSize = pEGLView->getFrameSize();
CCLOG("applicationDidFinishLaunching frameSize.width = %f frameSize.height= %f", frameSize.width,frameSize.height);
if(frameSize.height/frameSize.width>1.4){
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionFixedWidth);
} else {
pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionFixedHeight);
}
if(designResolutionSize.width == 720){
pDirector->setContentScaleFactor( smallResource_tate2.size.width / designResolutionSize.width ); //ч╕ж
} else {
pDirector->setContentScaleFactor( smallResource_yoko.size.width / designResolutionSize.width ); //цик
}
cocos2d::CCSize visibleSize = cocos2d::CCDirector::sharedDirector()->getVisibleSize();
cocos2d::CCPoint origin = cocos2d::CCDirector::sharedDirector()->getVisibleOrigin();
CCLOG("applicationDidFinishLaunching designResolutionSize.width = %f ", designResolutionSize.width);
CCLOG("applicationDidFinishLaunching designResolutionSize.height = %f ", designResolutionSize.height);
CCLOG("applicationDidFinishLaunching pDirector->getContentScaleFactor() = %f ", pDirector->getContentScaleFactor() );
CCLOG("applicationDidFinishLaunching visibleSize width=%f height=%f ", visibleSize.width, visibleSize.height );
CCLOG("applicationDidFinishLaunching origin x=%f y=%f ", origin.x, origin.y );
// create a scene. it's an autorelease object
CCScene *pScene = HelloWorld::scene();
//CCScene *pScene = HelloWorld2::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
示例15: CCEGLView
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;
}