当前位置: 首页>>代码示例>>C++>>正文


C++ setScale函数代码示例

本文整理汇总了C++中setScale函数的典型用法代码示例。如果您正苦于以下问题:C++ setScale函数的具体用法?C++ setScale怎么用?C++ setScale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setScale函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: stopAction

void Drop::stopWave()
{
	if (waveAction)
		stopAction(waveAction);
	setScale(1);
}
开发者ID:crazyboymx,项目名称:games,代码行数:6,代码来源:Drop.cpp

示例2: log

void ColleageLayer::initframe()
{
	Size size = Director::getInstance()->getVisibleSize();

	//±³¾°
	auto background = Sprite::create("ui/background_2.jpg");
	background->setScale(1.26f);
	background->setPosition(size.width/2, 760);
	this->addChild(background);

	//¼¼ÄÜѧԺ±³¾°
	auto listbase = Sprite::create("ui/collegebase.jpg");
	listbase->setScale(1.3f);
	listbase->setPosition(size.width/2, 400);
	this->addChild(listbase);

	//µ×²¿±³¾°
	auto bottom_list = Sprite::createWithSpriteFrameName("bottom_list.jpg");
	bottom_list->setPosition(size.width/2, bottom_list->getContentSize().height/2);
	this->addChild(bottom_list);

	//¶¥²¿ÎÄ×ֵı³¾°
	auto middletitlebase = Sprite::createWithSpriteFrameName("middletitlebase.png");
	middletitlebase->setPosition(size.width/2, 700);
	this->addChild(middletitlebase);

	//Îı¾ºÏ³É
	auto titletext = Sprite::createWithSpriteFrameName("titlename_college.png");
	titletext->setPosition(size.width/2, 690);
	this->addChild(titletext);

	//¶¥²¿·µ»Ø°´Å¥
	auto button_left_normal = Sprite::createWithSpriteFrameName("button_left_0.png");
	auto button_left_pressed = Sprite::createWithSpriteFrameName("button_left_1.png");
	auto button_left_disable = Sprite::createWithSpriteFrameName("button_left_2.png");
	auto menuItem = MenuItemSprite::create(button_left_normal, button_left_pressed, button_left_disable);
	menuItem->setCallback([](Ref* pSender){
		log("return");
		NotificationCenter::getInstance()->postNotification("ReturnToMain");
	});

	auto text_return = Sprite::createWithSpriteFrameName("text_return.png");
	text_return->setPosition(button_left_normal->getContentSize().width/2 - 15, button_left_normal->getContentSize().height/2);
	menuItem->addChild(text_return);

	auto menu_left = Menu::create(menuItem, NULL);
	menu_left->setPosition(menuItem->getContentSize().width/2 - 10, 687);
	this->addChild(menu_left);


	//¶¥²¿°ïÖú°´Å¥
	auto button_right_normal = Sprite::createWithSpriteFrameName("button_help_0.png");
	auto button_right_pressed = Sprite::createWithSpriteFrameName("button_help_1.png");
	auto button_right_disable = Sprite::createWithSpriteFrameName("button_help_0.png");
	auto button_right_menuItem = MenuItemSprite::create(button_right_normal, button_right_pressed, button_right_disable);
	button_right_menuItem->setCallback(CC_CALLBACK_1(ColleageLayer::menu_help_callback, this));
	auto menu_right = Menu::create(button_right_menuItem, NULL);
	menu_right->setPosition(size.width - button_right_menuItem->getContentSize().width /2 + 20, 687);
	this->addChild(menu_right);

	//ÖØÖð´Å¥
	auto button_reset_normal = Sprite::createWithSpriteFrameName("button_little_0.png");
	auto button_reset_pressed = Sprite::createWithSpriteFrameName("button_little_1.png");
	auto button_reset_disable = Sprite::createWithSpriteFrameName("button_little_2.png");
	reset_Item = MenuItemSprite::create(button_reset_normal, button_reset_pressed, button_reset_disable);
	reset_Item->setScale(0.8f);

	auto text_reset = Sprite::createWithSpriteFrameName("text_reset.png");
	text_reset->setPosition(button_reset_normal->getContentSize().width/2 - 15, button_reset_normal->getContentSize().height/2);
	reset_Item->addChild(text_reset);

	reset_Item->setCallback(CC_CALLBACK_1(ColleageLayer::menu_reset_callback, this));
	auto menu_reset = Menu::create(reset_Item, NULL);
	menu_reset->setPosition(size.width / 2 - 150, 193);
	this->addChild(menu_reset);

	//ѧϰ°´Å¥
	auto button_learn_normal = Sprite::createWithSpriteFrameName("button_little_0.png");
	auto button_learn_pressed = Sprite::createWithSpriteFrameName("button_little_1.png");
	auto button_learn_disable = Sprite::createWithSpriteFrameName("button_little_2.png");
	learn_Item = MenuItemSprite::create(button_learn_normal, button_learn_pressed, button_learn_disable);
	learn_Item->setScale(0.8f);
	learn_Item->setEnabled(false);

	auto text_learn = Sprite::createWithSpriteFrameName("text_learn.png");
	text_learn->setPosition(button_learn_normal->getContentSize().width/2 - 15, button_learn_normal->getContentSize().height/2);
	learn_Item->addChild(text_learn);

	learn_Item->setCallback(CC_CALLBACK_1(ColleageLayer::menu_learn_callback, this));
	auto menu_learn = Menu::create(learn_Item, NULL);
	menu_learn->setPosition(size.width / 2 + 150, 193);
	this->addChild(menu_learn);
}
开发者ID:Youjk,项目名称:CardGame,代码行数:93,代码来源:ColleageLayer.cpp

示例3: setScale

//-----------------------------------------------------------------------
void Node::setScale(Real x, Real y, Real z)
{
    setScale(Vector3(x, y, z));
}
开发者ID:feijing2132,项目名称:runairport,代码行数:5,代码来源:OgreNode.cpp

示例4: onEnter

void GameScene::onEnter()
{
	Scene::onEnter();
	auto& winSize = Director::getInstance()->getWinSize();
	auto& contentRect = Game::getContentRect();
	string fontName = "DolceVita.ttf";
	int x1 = contentRect.origin.x + wallThickness;
	int x2 = x1 + contentRect.size.width - wallThickness * 2;
	int y1 = contentRect.origin.y + wallThickness;
	int y2 = y1 + contentRect.size.height - wallThickness * 2;

	// Music
	SimpleAudioEngine::getInstance()->playBackgroundMusic("Song.mp3", true);

	// Stretched big background
	auto bg2 = LayerColor::create(Color4B(208, 204, 202, 255));
	bg2->setScale(2);
	this->addChild(bg2, -1);

	// Actual background
	auto bg = LayerColor::create(Color4B(218, 214, 212, 255), contentRect.size.width, contentRect.size.height);
	bg->setPosition(contentRect.origin);
	this->addChild(bg, 0);

	// Labels
	stringstream ss;
	ss << "Score: " << score;
	scoreLabel = Label::createWithTTF(ss.str().c_str(), fontName, 45);
	scoreLabel->setAnchorPoint(Vec2(0, 1));
	scoreLabel->setPosition(x1 + labelPadding, y2 - labelPadding);
	scoreLabel->setColor(Color3B(128, 128, 128));
	this->addChild(scoreLabel, 1);

	auto sceneLabel = Label::createWithTTF("Game Scene", fontName, 200);
	sceneLabel->setColor(Color3B(128, 128, 128));
	sceneLabel->setPosition(Game::centralize(0, 228));
	this->addChild(sceneLabel, 1);
	sceneLabel->runAction(Sequence::create(
		FadeOut::create(5),
		RemoveSelf::create(),
		nullptr
	));

	// Touch listners
	auto dispatcher = Director::getInstance()->getEventDispatcher();
	auto listener = EventListenerTouchAllAtOnce::create();
	listener->onTouchesBegan = [this] (const vector<Touch*>& touches, Event* event) {this->touchHandler("began", touches, event);};
	dispatcher->addEventListenerWithSceneGraphPriority(listener, this);

	// Start physics
	space = cpSpaceNew();
	space->gravity = cpv(0, gravity);

	// Walls
	createPhysicsBox(x1, y1, x2, contentRect.origin.y, 0.9, 0, collisionTypeWall); // bottom
	createPhysicsBox(x1, y2, x2, y2 + wallThickness, 0.9, 0, collisionTypeWall); // top
	createPhysicsBox(contentRect.origin.x, contentRect.origin.y, x1, y2 + wallThickness, 0.9, 0, collisionTypeWall); // left
	createPhysicsBox(x2, contentRect.origin.y, x2 + wallThickness, y2 + wallThickness, 0.9, 0, collisionTypeWall); // right

	// Ball
	ball = Sprite::create("Ball.png");
	createPhysicsSprite(ball, Vec2(winSize.width * 0.5f, winSize.height * 0.5f), 1.0f, 0.0f, collisionTypeBall);
	this->addChild(ball, 1);

	// Collision handler
	cpSpaceAddCollisionHandler(space, collisionTypeBall, collisionTypeWall, nullptr, nullptr, nullptr, GameScene::onCollision, nullptr);

	// Update
	this->scheduleUpdate();
}
开发者ID:MAUSMAUSgames,项目名称:RapidGame,代码行数:70,代码来源:GameScene.cpp

示例5: log

bool HomeScene::init(){
    if (!Scene::init()){
        return false;
    }

    SimpleAudioEngine::getInstance()->preloadEffect(Audio::RESTART_AUDIO.c_str());
    SimpleAudioEngine::getInstance()->preloadEffect(Audio::DIG_AUDIO.c_str());
    SimpleAudioEngine::getInstance()->preloadEffect(Audio::MINE1_AUDIO.c_str());
    SimpleAudioEngine::getInstance()->preloadEffect(Audio::BUTTON.c_str());
    SimpleAudioEngine::getInstance()->preloadEffect(Audio::FAIL_AUDIO.c_str());
    SimpleAudioEngine::getInstance()->preloadEffect(Audio::CRASH_AUDIO.c_str());


    Sprite *BG = Sprite::create("background.jpg");
    BG->setPosition(VISIZE.width / 2, VISIZE.height / 2);
    BG->setScaleX(VISIZE.width / BG->getContentSize().width);
    BG->setScaleY(VISIZE.height / BG->getContentSize().height);
    this->addChild(BG,0);

    c2 = Sprite::create("cloud2.png");
    c2->setPosition(VISIZE.width * 0.2, VISIZE.height * 0.4);
    c2->setScale(VISIZE.width / c2->getContentSize().width);
    this->addChild(c2,2);

    Sprite *star = Sprite::create("Brick.jpg");
    star->setPosition(VISIZE.width / 2, VISIZE.height / 2);
    star->setScaleX(VISIZE.width / star->getContentSize().width);
    star->setScaleY(VISIZE.height / star->getContentSize().height);
    this->addChild(star,3);


    dig_logo = Sprite::create("dig_logo.png");

    dig_logo->setPosition(VISIZE.width/2,VISIZE.height*0.6);
    dig_logo->setScale(VISIZE.width/dig_logo->getBoundingBox().size.width);
    this->addChild(dig_logo,4);


    auto playMenu = Sprite::create("pl.png");
    playMenu->runAction(MoveBy::create(0.5,Point(0,-playMenu->getBoundingBox().size.height/2)));
    playMenu->setPosition(dig_logo->getContentSize().width/2,dig_logo->getContentSize().height/2);
    dig_logo->addChild(playMenu);

    auto listenner = EventListenerTouchOneByOne::create();

    listenner->onTouchBegan = [=](Touch* touch,Event* event){

        if(playMenu->getBoundingBox().containsPoint(playMenu->getParent()->convertToNodeSpace(touch->getLocation()))){
            playMenu->setScale(playMenu->getScale()*1.2);
            isOut = false;
            log("ok");
            return true;
        }
        return false;
    };

    listenner->onTouchMoved = [=](Touch* touch,Event* event){
        if(playMenu->getBoundingBox().containsPoint(playMenu->convertToNodeSpace(touch->getLocation()))){
            isOut = true;
        }
        else{
            isOut = false;
        }
    };

    listenner->onTouchEnded = [=](Touch* touch,Event* event){
        if(!isOut){
            int beforeReplpace = 0.5;
            playMenu->setScale(playMenu->getScale()/1.2);
            dig_logo->runAction(EaseBackOut::create(MoveTo::create(beforeReplpace,Point(VISIZE.width/2,VISIZE.height*1.5))));
            playMenu->runAction(Sequence::create(EaseBackOut::create(MoveBy::create(beforeReplpace,Point(0,0))),
            CallFunc::create([=](){

                //this->runAction(RuduceVolume::create(0.3));
                Director::getInstance()->replaceScene(TransitionSlideInB::create(0.3,DigScene::createScene()));

            }), nullptr));


        }
    };


    playMenu->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listenner,dig_logo);



    return true;
}
开发者ID:Danielhu229,项目名称:Dig,代码行数:89,代码来源:HomeScene.cpp

示例6: switch

void SceneGraphComponent::executeEvent(GameEvent *event)
{
	switch (event->id())
	{
	case GameEvent::E_SET_TRANSFORMATION:
		setTransformation(static_cast<const float*>(event->data()));
		break;
	case GameEvent::E_TRANSFORMATION:
		memcpy(static_cast<float*>(event->data()), m_transformation, sizeof(float) * 16);
		break;
	case GameEvent::E_SET_TRANSLATION:
		{
			Vec3f* translation = static_cast<Vec3f*>(event->data());
			m_transformation[12] = translation->x;
			m_transformation[13] = translation->y;
			m_transformation[14] = translation->z;
			sendTransformation();
		}
		break;
	case GameEvent::E_SET_SCALE:
		setScale(static_cast<Vec3f*>(event->data()));
		break;
	case GameEvent::E_MESH_DATA:
		getMeshData(static_cast<MeshData*>(event->data()));
		break;
	case GameEvent::E_TRANSLATE_LOCAL:
		translateLocal(static_cast<Vec3f*>(event->data()));
		break;
	case GameEvent::E_TRANSLATE_GLOBAL:
		translateGlobal(static_cast<Vec3f*>(event->data()));
		break;
	case GameEvent::E_ROTATE_LOCAL:
		rotate(static_cast<Vec3f*>(event->data()));
		break;
	case GameEvent::E_SET_ROTATION:
		setRotation(static_cast<Vec3f*>(event->data()));
		break;
	case GameEvent::E_ATTACH:
		attach(static_cast<Attach*>(event->data()));
		break;	
	case GameEvent::E_SET_NODE_PARENT:
		setParentNode(static_cast<Attach*>(event->data()));
		break;
	case GameEvent::E_MORPH_TARGET:
		if (m_hordeID > 0)
		{
			h3dSetModelMorpher(m_hordeID, static_cast<MorphTarget*>(event->data())->Name, static_cast<MorphTarget*>(event->data())->Value);
			h3dUpdateModel(m_hordeID, H3DModelUpdateFlags::Geometry );		
		}
		break;
	case GameEvent::E_ACTIVATE_CAM:
		if (m_hordeID > 0 && h3dGetNodeType(m_hordeID) == H3DNodeTypes::Camera)
			SceneGraphManager::instance()->setActiveCam( m_hordeID );
		break;
	case GameEvent::E_SET_ANIM_FRAME:
		{
			if (m_hordeID > 0)
			{
				const SetAnimFrame* const data = static_cast<SetAnimFrame*>(event->data());			
				h3dSetModelAnimParams(m_hordeID, data->Stage, data->Time, data->Weight);	
				h3dUpdateModel(m_hordeID, H3DModelUpdateFlags::Animation | H3DModelUpdateFlags::Geometry );		
			}
		}
		break;
	case GameEvent::E_SET_ENABLED:
		setEnabled(*static_cast<bool*>(event->data()));
		break;
	case GameEvent::E_GET_VISIBILITY:
		{
			bool* visible = static_cast<bool*>(event->data());
			if (visible)
				*visible = getVisibility();
		}
		break;
	case GameEvent::E_GET_PROJECTION_MATRIX:
		{
			float* mat = static_cast<float*>(event->data());
			SceneGraphManager::instance()->getCameraProjectionMatrix(mat);
		}
		break;
	case GameEvent::E_GET_ACTIVE_CAM:
		if (SceneGraphManager::instance()->getActiveCam() == m_hordeID)
		{
			unsigned int* id = static_cast<unsigned int*>(event->data());
			if (id)
				*id = m_owner->worldId();
		}
		break;
	case GameEvent::E_GET_SCENEGRAPH_ID:
		{
			int* id = static_cast<int*>(event->data());
			if (id)
				*id = m_hordeID;
		}
		break;
	}
}
开发者ID:CZdravko,项目名称:Horde,代码行数:97,代码来源:SceneGraphComponent.cpp

示例7: init

bool SelectTowerLayer::init()
{
	if (!Layer::init())
	{
		return false;
	}
	 
	// show the position for tower
	auto towerPos = Sprite::create("towerPos.png");
	towerPos->setScale(0.7);
	//towerPos->setAnchorPoint(Vec2::ZERO);
	this->addChild(towerPos);

	menu = Menu::create();

	//according to Towers  to create equal num menuItems and the Sprite
	auto instance = GameManager::getInstance();
	int nums = instance->towerSelectVector.size();

	int currmoney = dynamic_cast<UiLayer*>(GameManager::getInstance()->getUiLayer())->getcurmoney();
	
	for (int i = 0; i < nums; i++)
	{
		int tower_count = instance->towerSelectVector.at(i);
		MenuItemImage* towerItem = MenuItemImage::create(StringUtils::format("startUI/tower__%02d.png", tower_count), StringUtils::format("startUI/tower__%02d.png", tower_count), StringUtils::format("startUI/tower__%02dunabled.png", tower_count), [=](Ref*)
		{			
			log("You select the %d", tower_count);
			//to assign the choose value when touch the menuItem
			addTower(tower_count);
			//clear up the contents
			 
			//this->removeAllChildrenWithCleanup(true);
			Layer::removeFromParent();
		});
		//judge this gold 
		switch (tower_count)
		{
		case 1:
			if (currmoney < TOWERONECOST)
			{
				towerItem->setEnabled(false);
			}
			break;
		case 2:
			if (currmoney < TOWERTWOCOST)
			{
				towerItem->setEnabled(false);
			}
			break;
		case 3:
			if (currmoney < TOWERTHREECOST)
			{
				towerItem->setEnabled(false);
			}
			break;
		case 4:
			if (currmoney < TOWERFORECOST)
			{
				towerItem->setEnabled(false);
			}
			break;
		case 5:
			if (currmoney < TOWERFIVECOST)
			{
				towerItem->setEnabled(false);
			}
			break;
		case 6:
			if (currmoney < TOWERSIXCOST)
			{
				towerItem->setEnabled(false);
			}
			break;
		case 7:
			if (currmoney < TOWERSEVENCOST)
			{
				towerItem->setEnabled(false);
			}
			break;
		case 8:
			if (currmoney < TOWEREIGHTCOST)
			{
				towerItem->setEnabled(false);
			}
			break;
		default:
			break;
		}
		
		int pos_x = i * 64;
		int pos_y = +64 * (i / 3 + 0);

		pos_x = pos_x - 3 * 64 * ((i / 3 + 0));

		towerItem->setPosition(pos_x, pos_y);
		menu->addChild(towerItem);
	}
	menu->setAnchorPoint(Vec2::ZERO);
	menu->setPosition(Vec2(-towerPos->getContentSize().width / 3 * 2, towerPos->getContentSize().height / 3 * 2));
 	this->addChild(menu);
//.........这里部分代码省略.........
开发者ID:joyfish,项目名称:TowerTD,代码行数:101,代码来源:SelectTowerLayer.cpp

示例8: setScale

 /**
  * Sets plot scale back to the defaults.
  *
  */
 void ScatterPlotWindow::resetScale(){
   setScale(QwtPlot::xBottom, p_MinOne, p_MaxOne);
   setScale(QwtPlot::yLeft, p_MinTwo, p_MaxTwo);
 }
开发者ID:assutech,项目名称:isis3,代码行数:8,代码来源:ScatterPlotWindow.cpp

示例9: addChild

void FightLayer::initCard(){
    
    auto fightBackground = Sprite::create("textures/IMG_Background/fight_background.png");
    auto cs = fightBackground->getContentSize();
    
    _bgSize = cs;
    _nFight = LayerColor::create(Color4B(255,0,0,0),cs.width,cs.height);
    _nFight->setAnchorPoint(Point(0.5,0));

    _animalNode = Node::create();
    
    auto p = VisibleRect::topRight()-Point(cs.width,cs.height);
    _nFight->setPosition(p.x/2,p.y/2);
    _animalNode->setPosition(Point(cs.width/2,cs.height/2)+Point(p.x/2,p.y/2));
    
    addChild(_nFight);
    addChild(_animalNode);
    
    auto node = Node::create();
    node->setPosition(cs.width/2,cs.height/2);
    node->addChild(fightBackground);
    _nFight->addChild(node);

    for(auto id=0;id<_myVec.size();id++){
        
        auto myCard = _myVec.at(id);
        auto scale = myCard->getScaleX();
        node->addChild(myCard);
        auto myAn = myCard->getAnimal()->getThisLayer();
        
        auto dcp = myCard->getPosition();
        auto dp = myAn->getPosition();
        auto np = dcp + Point(0, dp.y*scale);
        
        auto nd = Node::create();
        myAn->setScale(scale);
        myAn->setPosition(myAn->getPosition().x,0);
        nd->addChild(myAn);
        
        updatePoint(nd, np);
        _animalNode->addChild(nd);
    }
    
    for(auto ic = 0;ic<_monsterVec.size();ic++){
        
        auto msCard = _monsterVec.at(ic);
        auto cScale = msCard->getScaleX();
        node->addChild(msCard);
        auto msAn = msCard->getAnimal()->getThisLayer();
        
        auto cDcp = msCard->getPosition();
        auto cDp = msAn->getPosition();
        auto dNp = cDcp+Point(0,cDp.y*cScale);
        
        auto cNd = Node::create();
        msAn->setScale(cScale);
        msAn->setPosition(msAn->getPositionX(),0);
        cNd->addChild(msAn);
        
        updatePoint(cNd, dNp);
        _animalNode->addChild(cNd);
    }
}
开发者ID:RaoZiJian,项目名称:CardGameDemo,代码行数:63,代码来源:FightScene.cpp

示例10: Vec2

void Level20::restart() {
    BaseLevel::restart();

#define MOVE_BY_X 192

    auto r1 = Target::create();
    r1->setPosition(E::originX, E::originY + 420);
    r1->setRotation(45);
    r1->initBody();
    this->addChild(r1);
    r1->initProtector(192 - 32);
    r1->runAction(RepeatForever::create(Sequence::create(MoveBy::create(0.5f, Vec2(MOVE_BY_X, 0)), DelayTime::create(1.0f), MoveBy::create(0.5f, Vec2(-MOVE_BY_X, 0)), nullptr)));

    auto r2 = Target::create();
    r2->setPosition(E::originX + DESIGNED_WIDTH, E::originY + 420);
    r2->setRotation(-45);
    r2->initBody();
    this->addChild(r2);
    r2->initProtector(192 - 32);
    r2->runAction(RepeatForever::create(Sequence::create(MoveBy::create(0.5f, Vec2(-MOVE_BY_X, 0)), DelayTime::create(1.0f), MoveBy::create(0.5f, Vec2(MOVE_BY_X, 0)), nullptr)));

    auto ring1 = Ring::create();
    ring1->setPosition(E::originX + DESIGNED_WIDTH / 2 - 80, E::originY + 128 + 64);
    ring1->setScale(0.15);
    ring1->initBody();
    this->addChild(ring1);

    auto ring2 = Ring::create();
    ring2->setPosition(E::originX + DESIGNED_WIDTH / 2 + 80, E::originY + 128 + 64);
    ring2->setScale(0.15);
    ring2->initBody();
    this->addChild(ring2);

    auto b1 = Brick::create(192, 24);
    b1->setRotation(45);
    b1->setPosition(E::originX + DESIGNED_WIDTH / 2 - 192 + 32, E::originY + 96 );
    b1->initBody();
    this->addChild(b1);
    auto b12 = Brick::create(192, 16, E::P.C800);
    b12->setRotation(45);
    b12->setPosition(E::originX + DESIGNED_WIDTH / 2 - 192 + 32 + 16, E::originY + 96 + 8);
    b12->initBody();
    this->addChild(b12);

    auto b2 = Brick::create(192, 24);
    b2->setRotation(-45);
    b2->setPosition(E::originX + DESIGNED_WIDTH / 2 - 192 + 32 + 128, E::originY + 96 );
    b2->initBody();
    this->addChild(b2);
    auto b22 = Brick::create(192, 16, E::P.C800);
    b22->setRotation(-45);
    b22->setPosition(E::originX + DESIGNED_WIDTH / 2 - 192 + 32 - 16 + 128, E::originY + 96 + 8);
    b22->initBody();
    this->addChild(b22);

    auto diamond1 = Diamond::create();
    diamond1->setScale(0.9f);
    diamond1->setRotation(30);
    diamond1->setPosition(E::originX - 128, E::originY + 256 + 64);
    diamond1->initBody();
    this->addChild(diamond1);

    auto diamond2 = Diamond::create();
    diamond2->setScale(0.9f);
    diamond2->setRotation(-30);
    diamond2->setPosition(E::originX + DESIGNED_WIDTH + 128, E::originY + 256 + 64);
    diamond2->initBody();
    this->addChild(diamond2);

}
开发者ID:Ratel13,项目名称:arkaflow,代码行数:70,代码来源:Level20.cpp

示例11: setScale

void CModel::setScale(float x,float y,float z)
{
	temp_vec3.Set(x,y,z);
	setScale(temp_vec3);
}
开发者ID:azykise,项目名称:olawork,代码行数:5,代码来源:model.cpp

示例12: switch


//.........这里部分代码省略.........
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier  )
			OnMovePageUp();
		else if( (e->modifiers() & Qt::ControlModifier) && (e->modifiers() & Qt::ShiftModifier) )
			OnMoveCtrlShiftPageUp();
		else if( e->modifiers() & Qt::ShiftModifier )
			OnMoveShiftPageUp();
		else if( e->modifiers() & Qt::ControlModifier )
			OnMoveCtrlPageUp();
        return;
	case Qt::Key_PageDown:
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier  )
			OnMovePageDown();
		else if( (e->modifiers() & Qt::ControlModifier) && (e->modifiers() & Qt::ShiftModifier) )
			OnMoveCtrlShiftPageDown();
		else if( e->modifiers() & Qt::ShiftModifier )
			OnMoveShiftPageDown();
		else if( e->modifiers() & Qt::ControlModifier )
			OnMoveCtrlPageDown();
        return;
	case Qt::Key_Backspace:
		if( e->modifiers() == Qt::NoModifier )
			BackSpace();
        return;
	case Qt::Key_Delete:
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier )
			Delete();
        return;
    case Qt::Key_Return:
		if( e->modifiers() == Qt::NoModifier || e->modifiers() == Qt::KeypadModifier  )
		{
			rootNode()->MoveReturn();
			updateViewDocument();
			//cbFireEvent( FORMULIB_CALLBACK_ENTER, NULL, NULL );
		}
        return;
    case Qt::Key_Escape:
		if( e->modifiers() == Qt::NoModifier )
		{
			rootNode()->Escape();
			updateFormulatorWidget();
		}
        return;
	default:
		break;
	}

	if( e->matches( QKeySequence::Copy ) )
	{
		editCopy();
		return;
	}
	else if( e->matches( QKeySequence::Cut ) )
	{
		editCut();
		return;
	}
	else if( e->matches( QKeySequence::Paste ) )
	{
		editPaste();
		return;
	}
	if( e->matches( QKeySequence::Delete ) )
	{
		Delete();
		return;
	}
	else if( e->matches( QKeySequence::Undo ) )
	{
		editUndo();
		return;
	}
	else if( e->matches( QKeySequence::Redo ) )
	{
		editRedo();
		return;
	}
	else if( e->matches( QKeySequence::SelectAll ) )
	{
		editSelectAll();
	}
	else if( e->matches( QKeySequence::ZoomIn ) )
	{
		double value = qMin( scale() + DEFAULT_VIEWSCALE_STEP, DEFAULT_VIEWSCALE_MAX );
		setScale( value );
	}
	else if( e->matches( QKeySequence::ZoomOut ) )
	{
		double value = qMax( scale() - DEFAULT_VIEWSCALE_STEP, DEFAULT_VIEWSCALE_MIN );
		setScale( value );
	}
	else if( e->text().length() > 0 )
	{
		for( long i = 0; i < e->text().length(); i++ )
			rootNode()->Char( e->text().at( i ).unicode(), undoRedo() );
		updateViewDocument();
		//cbFireEvent( FORMULIB_CALLBACK_CHAR, nChar, NULL );
	}

	QFormulatorWidget::keyPressEvent( e );
}
开发者ID:Nilis640,项目名称:formulator-mathml,代码行数:101,代码来源:fmleditwidget.cpp

示例13: createObjectOnFloor

void Level01::setBG()
{
	m_worldMap = Node::create();

	if (UserDefault::getInstance()->getBoolForKey("light"))
	{
		m_collision = m_visibleSize.width*0.3;
	}
	else
	{
		m_collision = -m_visibleSize.width*0.7;
	}

	Sprite* bg[3];

	for (int i = 0; i < 3; i++)
	{
		bg[i] = Sprite::create("img/background.png");

		// position the sprite on the center of the screen
		bg[i]->setScale(m_visibleSize.width / m_visibleSize.height);
		bg[i]->setPosition(Point((m_visibleSize.width) * i+1, m_visibleSize.height / 2));

		// add the sprite as a child to this layer
		m_worldMap->addChild(bg[i]);
	}

	createObjectOnFloor(bg[1]->getBoundingBox().getMidX()- 200, "img/chair.png");
	createObjectOnFloor(bg[1]->getBoundingBox().getMidX(), "img/chair.png");
	createObjectOnFloor(bg[1]->getBoundingBox().getMidX(), "img/table.png");
	createObjectOnFloor(bg[0]->getBoundingBox().getMidX(), "img/chair.png");

	auto drawing2 = Sprite::create("img/drawing01.png");
	drawing2->setScale(2);
	drawing2->setPosition(Vec2(m_visibleSize.width * 1.3, m_visibleSize.height / 1.4));
	//m_worldMap->addChild(drawing2);

	//m_doorList[2] = createDoor(m_visibleSize.width * 2.7);
	m_doorList[0] = createDoor(convertToNodeSpace(sprite->getPosition()).x);
	//m_doorList[1] = createDoor(m_visibleSize.width * 3.4);

	auto sadman  = Sprite::create("img/sadman01.png");
	sadman->setScale(1.8);
	sadman->setPosition(Vec2(m_visibleSize.width * 1.2 + 55, m_floorPoint + sadman->getBoundingBox().getMaxY()));
	m_worldMap->addChild(sadman);
	if (UserDefault::getInstance()->getBoolForKey("light"))
	{
		sadman->setVisible(true);
	}
	else
	{
		sadman->setVisible(false);
	}

	auto sadmanAnim = Animation::create();
	sadmanAnim->addSpriteFrameWithFileName("img/sadman01.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman01.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman02.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman01.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman02.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman03.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman02.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman03.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman02.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman03.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman02.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman03.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman04.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman04.png");
	sadmanAnim->addSpriteFrameWithFileName("img/sadman04.png");
	sadmanAnim->setLoops(-1);
	sadmanAnim->setDelayPerUnit(0.3f);
	sadmanAnim->setRestoreOriginalFrame(true);

	auto sadmanAnimate = Animate::create(sadmanAnim);
	sadman->runAction(RepeatForever::create(sadmanAnimate));

	m_doorList[1] = sadman;

	this->addChild(m_worldMap);
}
开发者ID:riverreal,项目名称:The-Shepherd,代码行数:81,代码来源:Level01.cpp

示例14: dlg

// -----------------------------------------------------------------------------
// Static function to check if an archive has sufficient texture related
// entries, and if not, prompts the user to either create or import them.
// Returns true if the entries exist, false otherwise
// -----------------------------------------------------------------------------
bool TextureXEditor::setupTextureEntries(Archive* archive)
{
	using Format = TextureXList::Format;

	// Check any archive was given
	if (!archive)
		return false;

	// Search archive for any ZDoom TEXTURES entries
	Archive::SearchOptions options;
	options.match_type = EntryType::fromId("zdtextures");
	auto entry_tx      = archive->findFirst(options); // Find any TEXTURES entry

	// If it's found, we're done
	if (entry_tx)
		return true;


	// Search archive for any texture-related entries
	options.match_type = EntryType::fromId("texturex");
	entry_tx           = archive->findFirst(options); // Find any TEXTUREx entry
	options.match_type = EntryType::fromId("pnames");
	auto entry_pnames  = archive->findFirst(options); // Find any PNAMES entry

	// If both exist, we're done
	if (entry_tx && entry_pnames)
		return true;

	// Todo: accept entry_tx without pnames if the textures are in Jaguar mode

	// If no TEXTUREx entry exists
	if (!entry_tx)
	{
		// No TEXTUREx entries found, so ask if the user wishes to create one
		wxMessageDialog dlg(
			nullptr,
			"The archive does not contain any texture definitions (TEXTURE1/2 or TEXTURES). "
			"Do you wish to create or import a texture definition list?",
			"No Texture Definitions Found",
			wxYES_NO);

		if (dlg.ShowModal() == wxID_YES)
		{
			CreateTextureXDialog ctxd(nullptr);

			while (true)
			{
				// Check if cancelled
				if (ctxd.ShowModal() == wxID_CANCEL)
					return false;

				if (ctxd.createNewSelected())
				{
					// User selected to create a new TEXTUREx list
					ArchiveEntry* texturex = nullptr;

					// Doom or Strife TEXTUREx
					if (ctxd.getSelectedFormat() == Format::Normal || ctxd.getSelectedFormat() == Format::Strife11)
					{
						// Create texture list
						TextureXList txlist;
						txlist.setFormat(ctxd.getSelectedFormat());

						// Create patch table
						PatchTable ptt;

						// Create dummy patch
						auto dpatch = App::archiveManager().programResourceArchive()->entryAtPath("s3dummy.lmp");
						archive->addEntry(dpatch, "patches", true);
						ptt.addPatch("S3DUMMY");

						// Create dummy texture
						auto dummytex = std::make_unique<CTexture>();
						dummytex->setName("S3DUMMY");
						dummytex->addPatch("S3DUMMY", 0, 0);
						dummytex->setWidth(128);
						dummytex->setHeight(128);
						dummytex->setScale({ 0., 0. });

						// Add dummy texture to list
						// (this serves two purposes - supplies the special 'invalid' texture by default,
						//   and allows the texturex format to be detected)
						txlist.addTexture(std::move(dummytex));

						// Add empty PNAMES entry to archive
						entry_pnames = archive->addNewEntry("PNAMES");
						ptt.writePNAMES(entry_pnames);
						entry_pnames->setType(EntryType::fromId("pnames"));
						entry_pnames->setExtensionByType();

						// Add empty TEXTURE1 entry to archive
						texturex = archive->addNewEntry("TEXTURE1");
						txlist.writeTEXTUREXData(texturex, ptt);
						texturex->setType(EntryType::fromId("texturex"));
						texturex->setExtensionByType();
//.........这里部分代码省略.........
开发者ID:sirjuddington,项目名称:SLADE,代码行数:101,代码来源:TextureXEditor.cpp

示例15: setIsHDPanel

bool WatchtowerView::init(int buildId)
{
    if (!PopupBaseView::init()) {
        return false;
    }
    setIsHDPanel(true);
    CCLoadSprite::doResourceByCommonIndex(8, true,true);
    CCLoadSprite::doResourceByCommonIndex(500, true,true);
    setCleanFunction([](){
        CCLoadSprite::doResourceByCommonIndex(8, false,true);
        CCLoadSprite::doResourceByCommonIndex(500, false,true);
    });
    auto tbg = CCLoadSprite::loadResource("technology_09.png");
    auto tBatchNode = CCSpriteBatchNode::createWithTexture(tbg->getTexture());
    int maxHight = CCDirector::sharedDirector()->getWinSize().height;
    int curHight = -500;
    while (curHight<maxHight) {
        auto bg = CCLoadSprite::createSprite("technology_09.png");
        bg->setAnchorPoint(ccp(0, 1));
        bg->setPosition(ccp(0, curHight));
        curHight += bg->getContentSize().height;
        tBatchNode->addChild(bg);
        if (CCCommonUtils::isIosAndroidPad())
        {
            bg->setScale(2.4f);
        }
    }
    this->addChild(tBatchNode);
    m_buildId = buildId;
    auto tmpCCB = CCBLoadFile("WatchtowerView",this,this);
    this->setContentSize(tmpCCB->getContentSize());
    
    setTitleName(_lang("102160").c_str());
    m_callCount = 10;
    m_tabView = NULL;
    m_buildBG->setVisible(false);
    if (!CCCommonUtils::isIosAndroidPad()) {
        int oldBgHeight = m_buildBG->getContentSize().height;
        changeBGHeight(m_buildBG);
        int newBgHeight = m_buildBG->getContentSize().height;
        int extH = getExtendHeight();
        int addHeight = newBgHeight - oldBgHeight;
        int oldWidth = m_infoList->getContentSize().width;
        int oldHeight = m_infoList->getContentSize().height;
        //    m_infoList->setPositionY(m_infoList->getPositionY()-addHeight);
        m_infoList->setContentSize(CCSizeMake(oldWidth, oldHeight+extH));
        m_bottomNode->setPositionY(m_bottomNode->getPositionY() - extH);
        
        bool flag = false;
        if (ActivityController::getInstance()->aActivityInfo.activityST<=0 || ActivityController::getInstance()->aActivityInfo.siegeET<=0 ||ActivityController::getInstance()->aActivityInfo.round==0) {
            MonsterSiegeActivityInfoCommand* cmd = new MonsterSiegeActivityInfoCommand();
            cmd->setCallback(CCCallFuncO::create(this, callfuncO_selector(WatchtowerView::getInfoCallBack), NULL));
            cmd->sendAndRelease();
        }else{
            double prevTime = GlobalData::shared()->getWorldTime() - ActivityController::getInstance()->aActivityInfo.activityST;
            double gapTime = ActivityController::getInstance()->aActivityInfo.activityET - GlobalData::shared()->getWorldTime() ;
            double gapEnd = ActivityController::getInstance()->aActivityInfo.siegeET - GlobalData::shared()->getWorldTime();
            flag = ActivityController::getInstance()->aActivityInfo.activityST>0 && gapEnd>0 && gapTime>0 && prevTime>=0 && GlobalData::shared()->playerInfo.isInAlliance();
        }
        if(flag){
            showMonsterInfo();
        }
    }
    m_tabView = CCMultiColTableView::create(this, m_infoList->getContentSize());
    m_tabView->setDirection(kCCScrollViewDirectionVertical);
    m_tabView->setVerticalFillOrder(kCCTableViewFillTopDown);
    m_tabView->setMultiColTableViewDelegate(this);
    m_tabView->setTouchPriority(Touch_Popup);
    m_infoList->addChild(m_tabView);
    
    m_msgLabel->setString(_lang("108647"));
    
    FunBuildInfo& m_info = FunBuildController::getInstance()->getFunbuildById(m_buildId);
    
    string title = _lang(m_info.name)+" "+_lang_1("102272", CC_ITOA(m_info.level));
    if(FunBuildController::getInstance()->checkOpenUpstar(m_info.type)
       && FunBuildController::getInstance()->building_Miracle_open){
        if(m_info.starNum >= 1){
            title = _lang(m_info.name) +" "+ _lang("160001");
            title.append(" ");
            title.append(CC_ITOA(m_info.starNum));
        }
    }
    setTitleName(title.c_str());
    CCCommonUtils::setButtonTitle(m_ignoreBtn, _lang("139500").c_str());
    if (EnemyInfoController::getInstance()->m_enemyInfos.size() > 0) {
        m_bottomNode->setVisible(true);
    }
    else
        m_bottomNode->setVisible(false);
    updateInfo(NULL);
    
    return true;
}
开发者ID:ourgames,项目名称:dc208,代码行数:94,代码来源:WatchtowerView.cpp


注:本文中的setScale函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。