示例#1
0
/**
 * 开始移动
 * 设置移动动画的定时器
 */
void SimpleMoveComponent::startMove()
{
    CCLOG("startMove");
	m_moveState=MoveStart;
    CCDirector* director = CCDirector::sharedDirector();
    CCScheduler* pScheduler = director->getScheduler();
    pScheduler->scheduleSelector(m_update,this, 0, false);
    didMoveStart();
}
示例#2
0
void AutoAttackComponent::attack()
{
    CCLOG("AutoAttackComponent::startAttack");
	if (m_target) {
        CCDirector* director = CCDirector::sharedDirector();
        CCScheduler* pScheduler = director->getScheduler();
        pScheduler->scheduleSelector(schedule_selector(AutoAttackComponent::updateAttack),this, m_attackSpeed, false);
	}
}
示例#3
0
bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());

    // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
    TargetPlatform target = getTargetPlatform();//获取当前设备类型
    
    if (target == kTargetIpad){//如果是Ipad
        if (pDirector->enableRetinaDisplay(true)){ //如果开启高清视网膜
            
        }else {
        }
    }
    else if (target == kTargetIphone) {//如果是iphone
        if (pDirector->enableRetinaDisplay(true))
        {
        }
        else
        {
        }
    }
    else if (target == kTargetAndroid)//如果是android
    {
    }
    else if (target == kTargetWindows)//如果是Windows
    {
    }
    else if (target == kTargetMacOS)//如果是MacOS
    {
    }
    

    // turn on display FPS
    pDirector->setDisplayStats(false);

    // set FPS. the default value is 1.0/60 if you don't call thisdf
    pDirector->setAnimationInterval(1.0 / 60);
   
    // game init
    CCScheduler * scheduler = CCDirector::sharedDirector()->getScheduler();
    scheduler->scheduleSelector(schedule_selector(AppDelegate::AppUpdate), this, 1.0f/60, false);
    
    if( GameControl::RunGameControl() )
	{
		NetMessageManager::GetMessageManager();
	}

	if(  SceneManage::GetSceneManageHendle() )
	{
        SceneManage::GetSceneManageHendle()->RunScece( SCENE_LOGIN, false );
	}
   
    return true;
}
示例#4
0
void HeartBeatPackageSender::StartSender()
{
    CCScheduler * pSchedule = CCDirector::sharedDirector()->getScheduler();
    if (pSchedule)
    {
        pSchedule->scheduleSelector(schedule_selector(HeartBeatPackageSender::SendHeartBeatMessage),
                                    this,
                                    messageSenderDeltaTimer,
                                    false);
    }
}
示例#5
0
void MyCCOjbectImpl::RemoveUnusedRes(float fDelay)
{
	if (fDelay <= 0) {
		this->RemoveUnusedResImm(0);
		return;
	}

	CCScheduler* pScheduler = CCDirector::sharedDirector()->getScheduler();
	if (NULL == pScheduler) {
		return;
	}

	pScheduler->scheduleSelector(schedule_selector(MyCCOjbectImpl::RemoveUnusedResImm), this, 0, 0, fDelay, false);
}
示例#6
0
文件: NDTimer.cpp 项目: chaosren/HHHH
void NDTimer::SetTimer(ITimerCallback* timerCallback, OBJID tag, float interval)
{
	if (timerCallback && interval > 0)
	{
		IMP_CALLBACK cbImp;
		cbImp.tag = tag;
		cbImp.timerCallback = timerCallback;

		if (m_mapTimer.count(cbImp) <= 0)
		{
			CCScheduler *sch = GetScheduler();
			Timer *timer = new Timer;
			timer->setTag(tag);
			timer->setTimerCallback(timerCallback);
			sch->scheduleSelector(schedule_selector(Timer::onTimer), timer,
					interval, false);
			m_mapTimer[cbImp] = timer;
		}
	}
}
void CCResourceLoader::run() {
	CCScheduler* scheduler = CCDirector::sharedDirector()->getScheduler();
	scheduler->scheduleSelector(schedule_selector(CCResourceLoader::doLoad), this, 0, kCCRepeatForever, m_delay, false);
}