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


C++ UserDefault::setFloatForKey方法代码示例

本文整理汇总了C++中UserDefault::setFloatForKey方法的典型用法代码示例。如果您正苦于以下问题:C++ UserDefault::setFloatForKey方法的具体用法?C++ UserDefault::setFloatForKey怎么用?C++ UserDefault::setFloatForKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserDefault的用法示例。


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

示例1: cambiarSonido

void Ajustes::cambiarSonido(float positionX,bool fondo){
    float min = 0.0;
    float max = 0.0;
    if(!fondo){
        min = barraEfectos->getPositionX()-((barraEfectos->getContentSize().width*escala)/2);
        max = barraEfectos->getPositionX()+((barraEfectos->getContentSize().width*escala)/2);
    }else{
        min = barraMusica->getPositionX()-((barraMusica->getContentSize().width*escala)/2);
        max = barraMusica->getPositionX()+((barraMusica->getContentSize().width*escala)/2);
    }
    float maxOriginal = max-min;
    float valorOriginal = positionX-min;
    float porcentaje = (floorf((100*valorOriginal)/maxOriginal))/100;
    
    UserDefault *preferencias = UserDefault::getInstance();
    if(positionX>min&&positionX<max){
        if(!fondo){
            btEfectos->setPositionX(positionX);
            Configuracion::volumenEfectos = porcentaje;
            CocosDenshion::SimpleAudioEngine::getInstance()->setEffectsVolume(Configuracion::volumenEfectos);
            preferencias->setFloatForKey("volEfectos", porcentaje);
        }else{
            btMusica->setPositionX(positionX);
            Configuracion::volumenMusica = porcentaje;
            CocosDenshion::SimpleAudioEngine::getInstance()->setBackgroundMusicVolume(Configuracion::volumenMusica);
            preferencias->setFloatForKey("volMusica", porcentaje);
        }
    }
}
开发者ID:si2info,项目名称:info.si2.mostrosity,代码行数:29,代码来源:Ajustes.cpp

示例2: setSprite

void NegiSprite::setSprite()
{
    this->setPosition(Vec2(WINSIZE.width/2, WINSIZE.height/2));
    
    float setLine = 3.0;
    
    UserDefault *userDef = UserDefault::getInstance();
    userDef->setFloatForKey("SetLine", setLine);
    userDef->flush();
}
开发者ID:unlimited02,项目名称:BackCoverCut2,代码行数:10,代码来源:Negi.cpp

示例3: setSprite

void BookSprite::setSprite()
{
    Size visibleSize = WINSIZE;
    Vec2 origin = Director::getInstance()->getVisibleOrigin();

    this->setPosition(Vec2(WINSIZE.width/1.4, WINSIZE.height/2));
    
    float setLine = 2.2;
    
    UserDefault *userDef = UserDefault::getInstance();
    userDef->setFloatForKey("SetLine", setLine);
    userDef->flush();
}
开发者ID:unlimited02,项目名称:test,代码行数:13,代码来源:Book.cpp

示例4: onContactBegin

bool GameScene::onContactBegin(PhysicsContact& contact)
{
	auto bodyA = contact.getShapeA()->getBody();
	auto bodyB = contact.getShapeB()->getBody();

	distanceFromHook = player->getPosition().distance(contact.getShapeA()->getBody()->getPosition());

	if ((bodyA->getCategoryBitmask() & bodyB->getCollisionBitmask()) == 0
		|| (bodyB->getCategoryBitmask() & bodyA->getCollisionBitmask()) == 0)
	{
		// Player hits goal
		if (bodyA->getTag() == PLAYER && bodyB->getTag() == GOAL)
		{
			CocosDenshion::SimpleAudioEngine::sharedEngine()->stopBackgroundMusic();
			if (!Constant::soundMuted)
			{
				CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("Sounds/Goal/IndianWarChant 6077_99.mp3");
			}
			UserDefault *def = UserDefault::getInstance();
			def->getFloatForKey(Constant::mapname.c_str(), highscore);

			if (timeMilliseconds < highscore || highscore == 0)
			{
				highscore = timeMilliseconds;
				def->setFloatForKey(Constant::mapname.c_str(), highscore);
			}
			this->GoToLevelMenuScene(this);
			return false;
		}
		if (bodyB->getTag() == PLAYER && bodyA->getTag() == GOAL)
		{
			this->GoToLevelMenuScene(this);
			return false;
		}

		// Hook hits player, cancel
		if (bodyA->getTag() == PLAYER && bodyB->getTag() == HOOK)
		{
			return false;
		}
		if (bodyB->getTag() == PLAYER && bodyA->getTag() == HOOK)
		{
			return false;
		}

		// RayBox hits player, cancel
		if (bodyA->getTag() == PLAYER && bodyB->getTag() == RAYCASTCOLLISIONBOX)
		{
			return false;
		}
		if (bodyB->getTag() == PLAYER && bodyA->getTag() == RAYCASTCOLLISIONBOX)
		{
			return false;
		}

		// RayBox hits spikes, cancel
		if (bodyA->getTag() == SPIKE && bodyB->getTag() == RAYCASTCOLLISIONBOX)
		{
			sprite->stopAllActions();
			return false;
		}
		if (bodyB->getTag() == SPIKE && bodyA->getTag() == RAYCASTCOLLISIONBOX)
		{
			sprite->stopAllActions();
			return false;
		}

		// Player hits spikes, suffer agonizing death.
		if (bodyA->getTag() == SPIKE && bodyB->getTag() == PLAYER)
		{
			this->RestartScene(this);
			return false;
		}
		if (bodyB->getTag() == SPIKE && bodyA->getTag() == PLAYER)
		{
			this->RestartScene(this);
			return false;
		}

		// // RayBox hits metal, cancel
		if (bodyA->getTag() == RAYCASTCOLLISIONBOX && bodyB->getTag() == METAL)
		{
			sprite->stopAllActions();
			return false;
		}
		if (bodyB->getTag() == RAYCASTCOLLISIONBOX && bodyA->getTag() == METAL)
		{
			sprite->stopAllActions();
			return false;
		}

		if (sprite)
		{
			// RayBox hits tiles
			if (player->isTouchHold)
			{
				if (bodyA->getTag() == RAYCASTCOLLISIONBOX && bodyB->getTag() == TILE)
				{
					sprite->stopAllActions();
					boxHitPos = bodyA->getPosition();
//.........这里部分代码省略.........
开发者ID:kajaani,项目名称:Konks,代码行数:101,代码来源:GameScene.cpp


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