コード例 #1
0
ファイル: GameSlide.cpp プロジェクト: SIM0NL1/DND
void GameSlide::setDirection( Point movePoint )
{
	float gap_x = movePoint.x-m_startPoint.x;
	float gap_y = movePoint.y-m_startPoint.y;
	log(" gap_x  =  %f,  gap_y  =  %f",fabsf(gap_x),fabsf(gap_y));
	SlideDirection _direction=SlideDirection::SlideNone;
	float _distance = 0;
	if (fabsf(gap_x)>fabsf(gap_y))
	{
		//水平方向开启关卡模式切换;
		//g_pGameMain->controlPageView(true);
		//g_pGameMain->controlTableView(false);
		_direction = gap_x > 0 ? SlideDirection::SlideRight : SlideDirection::SlideLeft;
		_distance = fabsf(gap_x);
	} 
	else
	{
		//垂直方向关闭关卡模式切换;
		//g_pGameMain->controlTableView(true);
		//g_pGameMain->controlPageView(false);
		_direction = gap_y > 0 ? SlideDirection::SlideUp : SlideDirection::SlideDown;
		_distance = fabsf(gap_y);
	}
	setMainInterface(_distance,_direction);
}
コード例 #2
0
ファイル: interfacemanager.cpp プロジェクト: mojca/gecko
AbstractInterface *InterfaceManager::create (const QString &type, const QString &name) {
    if (get (name)) { // name already exists
        return NULL;
    }

    if (registry_.contains (type)) {
        AbstractInterface *i = (*registry_.value (type).fac) (getNextId (), name);
        i->setTypeName (type);
        if (items_->empty ()) // this is the first interface, make it the main interface
            setMainInterface (i);
        items_->push_back (i);
        emit interfaceAdded (i);
        return i;
    } else {
        return NULL;
    }
}