Esempio n. 1
0
void CAAlertView::onClickButton(CAControl* btn, CCPoint point)
{
	if (m_pCAlertBtnEvent && m_pCAlertTarget)
	{
		((CAObject*)m_pCAlertTarget->*m_pCAlertBtnEvent)(btn->getTag());
	}
	CAApplication* pApplication = CAApplication::getApplication();
	CCAssert(pApplication != NULL, "");
	pApplication->getRootWindow()->removeSubview(this);
	autorelease();
}
Esempio n. 2
0
CAViewController::~CAViewController()
{
    m_pView->setViewDelegate(NULL);
    CC_SAFE_RELEASE_NULL(m_pView);
    CC_SAFE_RELEASE_NULL(m_pTabBarItem);
    CC_SAFE_RELEASE_NULL(m_pNavigationBarItem);
    CAApplication* pDirector = CAApplication::getApplication();
    if (m_bKeypadEnabled)
    {
        pDirector->getKeypadDispatcher()->removeDelegate(this);
    }
}
Esempio n. 3
0
bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CAApplication* application = CAApplication::getApplication();
    
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

    application->setOpenGLView(pEGLView);

    // run
    application->runWindow(RootWindow::getInstance());

    return true;
}
Esempio n. 4
0
bool CAWindow::init()
{
    bool bRet = false;
     do 
     {
         CAApplication * pDirector;
         CC_BREAK_IF( ! (pDirector = CAApplication::getApplication()) );
         CCRect rect = CCRectZero;
         rect.size = pDirector->getWinSize();
         this->setFrame(rect);
         
         bRet = true;
     } while (0);
     return bRet;
}
Esempio n. 5
0
 JNIEXPORT jboolean JNICALL Java_org_CrossApp_lib_CrossAppRenderer_nativeKeyDown(JNIEnv * env, jobject thiz, jint keyCode) {
     CAApplication* pDirector = CAApplication::getApplication();
     switch (keyCode) {
         case KEYCODE_BACK:
               if (pDirector->getKeypadDispatcher()->dispatchKeypadMSG(kTypeBackClicked))
                 return JNI_TRUE;
             break;
         case KEYCODE_MENU:
             if (pDirector->getKeypadDispatcher()->dispatchKeypadMSG(kTypeMenuClicked))
                 return JNI_TRUE;
             break;
         default:
             return JNI_FALSE;
     }
     return JNI_FALSE;
 }
Esempio n. 6
0
bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CAApplication* pDirector = CAApplication::getApplication();
    CCLog("%f", pDirector->getAdaptationRatio());
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

    pDirector->setOpenGLView(pEGLView);

    pDirector->setDelegate(this);

    // 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.0f);

    // create a scene. it's an autorelease object

    m_pWindow = MainMenu::createWindow();
    // run
    pDirector->runWindow(m_pWindow);

    return true;
}
Esempio n. 7
0
/// isKeypadEnabled setter
void CAViewController::setKeypadEnabled(bool enabled)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
    if (enabled != m_bKeypadEnabled)
    {
        m_bKeypadEnabled = enabled;
        
        CAApplication* pDirector = CAApplication::getApplication();
        if (enabled)
        {
            pDirector->getKeypadDispatcher()->addDelegate(this);
        }
        else
        {
            pDirector->getKeypadDispatcher()->removeDelegate(this);
        }
    }
#endif
}
Esempio n. 8
0
void CAAlertView::showMessage(std::string title, std::string alertMsg, std::vector<std::string>& vBtnText)
{
	setTitleImage(CAImage::create("source_material/alert_title.png"));
	setContentBackGroundImage(CAImage::create("source_material/alert_content.png"));
	setTitle(title.c_str(), CAColor_white);
	setAlertMessage(alertMsg.c_str());
	
	initAllButton(vBtnText);
	setAllBtnBackGroundImage(CAControlStateNormal, CAImage::create("source_material/alert_btn.png"));
	setAllBtnBackGroundImage(CAControlStateHighlighted, CAImage::create("source_material/alert_btn_sel.png"));
	setAllBtnTextColor();

	calcuCtrlsSize();

	CAApplication* pApplication = CAApplication::getApplication();
	CCAssert(pApplication != NULL, "");
	pApplication->getRootWindow()->insertSubview(this, CAWindowZoderCenter);
	retain();
}