コード例 #1
0
void cursor::manageHit()
{
    if(hit)
    {
        hitSprite.setColor(sf::Color(255, 255, 255, 255));
        hit = false;
    }
    else if(hitSprite.getColor().a > 0)
    {
        int currentAlpha = hitSprite.getColor().a;
        a += timeModifier;
        while(a > 1)
        {
            currentAlpha -= 15;
            a -= 15;
        }
        if(a < 0)
            a = 0;

        if(currentAlpha < 0)
            currentAlpha = 0;

        hitSprite.setColor(sf::Color(255, 255, 255, currentAlpha));
    }
    hitSprite.setPosition(sprite.getPosition());
    hitSprite.setRotation(sprite.getRotation());
}
コード例 #2
0
ファイル: SplashScreen.cpp プロジェクト: terepaii/Graverted
void SplashScreen::fadeSpriteOut(sf::RenderWindow & renderWindow, sf::Sprite& sprite) 
{
	if(sprite.getColor().a > 0)
	{
		sf::Color color = sprite.getColor();
		color.a--;
		sprite.setColor(color);
	}else{
		stopSplash = true;
	}
}
コード例 #3
0
ファイル: SplashScreen.cpp プロジェクト: terepaii/Graverted
void SplashScreen::fadeSpriteIn(sf::RenderWindow & renderWindow, sf::Sprite& sprite) 
{
    if((int)sprite.getColor().a < 255)
	{
		sf::Color color = sprite.getColor();
		color.a++;
		sprite.setColor(color);
	}else{
		fadeIn = false;
	}
}
コード例 #4
0
ファイル: SimpleAnimator.cpp プロジェクト: ZwodahS/DiceBattle
void SimpleAnimator::fadeReference(sf::Sprite &sprite, int targetAlpha , float time)
{
    SpriteReferenceAnimationObject* obj = new SpriteReferenceAnimationObject(sprite);
    FadeInstruction* fi = new FadeInstruction(sprite.getColor().a, targetAlpha, time);
    obj->setInstruction(fi);
    objects.push_back(obj);
}
コード例 #5
0
void AnimatedSprite::replaceFrame(sf::Sprite sprite, unsigned int frame)
{
	if(frame < m_numFrames)
	{
		m_sprites[frame] = sprite;
		m_spriteColors[frame] = sprite.getColor();
	}
}
コード例 #6
0
void AnimatedSprite::insertFrame(sf::Sprite sprite, unsigned int frame)
{
	if(frame <= m_numFrames)
	{
		m_sprites.insert(m_sprites.begin() + frame, sprite);
		m_spriteColors.insert(m_spriteColors.begin() + frame, sprite.getColor());
		m_numFrames++;
	}
}
コード例 #7
0
ファイル: f_sprites.hpp プロジェクト: ZwodahS/LD28
 static std::vector<sf::Sprite> split4(sf::Sprite sprite)
 {
     std::vector<sf::Sprite> splits = std::vector<sf::Sprite>(0);
     const sf::Texture* texture = sprite.getTexture();
     sf::IntRect baseRect = sprite.getTextureRect();
     sf::Vector2f position = sprite.getPosition();
     splits.push_back(sf::Sprite(*texture, sf::IntRect(baseRect.left,baseRect.top,baseRect.width/2,baseRect.height/2)));
     splits[0].setPosition(position.x,position.y);
     splits[0].setColor(sprite.getColor());
     splits.push_back(sf::Sprite(*texture, sf::IntRect(baseRect.left+(baseRect.width/2), baseRect.top, baseRect.width/2, baseRect.height/2)));
     splits[1].setPosition(position.x+baseRect.width/2,position.y);
     splits[1].setColor(sprite.getColor());
     splits.push_back(sf::Sprite(*texture, sf::IntRect(baseRect.left, baseRect.top+(baseRect.height/2), baseRect.width/2 , baseRect.height/2)));
     splits[2].setPosition(position.x,position.y+baseRect.height/2);
     splits[2].setColor(sprite.getColor());
     splits.push_back(sf::Sprite(*texture, sf::IntRect(baseRect.left+(baseRect.width/2), baseRect.top+(baseRect.height/2), baseRect.width/2 , baseRect.height/2)));
     splits[3].setPosition(position.x+baseRect.width/2,position.y+baseRect.height/2);
     splits[3].setColor(sprite.getColor());
     return splits;
 }
コード例 #8
0
void AnimatedSprite::pushFrame(sf::Sprite sprite)
{
	m_sprites.push_back(sprite);
	m_spriteColors.push_back(sprite.getColor());
	m_numFrames++;
}
コード例 #9
0
ファイル: c_main.cpp プロジェクト: TideSofDarK/grief-trigger
	void update(sf::Time time)
	{
		MusicManager::instance().update(time);

		system.update(time);

		sm.update();
		oTweener.step(time.asMilliseconds() / 1000.f);

		if ((int)(rand() % 90) == 3 && first) sm.setCurrentEffect("distortion", sf::seconds(0.05));
		if ((int)(rand() % 100) == 3 && !first) sm.setCurrentEffect("inversion", sf::seconds(1));

		if (first)
		{
			logo.setColor(sf::Color(255,255,255,interpolateLinear(logo.getColor().a, 255, 0.05f)));
			logo.setPosition(0, newLogoY);

			if (!pressFading)
			{
				press.setColor(sf::Color(255,255,255,interpolateLinear(press.getColor().a, 0,pressFactor)));
				if (press.getColor().a < 7)
				{
					pressFading = true;
				}
			}
			else
			{
				press.setColor(sf::Color(255,255,255,interpolateLinear(press.getColor().a, 255, pressFactor)));
				if (press.getColor().a > 243)
				{
					pressFading = false;
				}
			}

			sprite.update(time);

			if (transition && timer.getElapsedTime().asSeconds() > 0.5)
			{
				press.setColor(sf::Color(255,255,255,0));
			}

			if (transition && timer.getElapsedTime().asSeconds() > 0.5)
			{
				transition = false;
				oTweener.addTween(&CDBTweener::TWEQ_BACK, CDBTweener::TWEA_INOUT, 2.f, &newLogoY, -800.0f);
			}

			if (!transition && logo.getPosition().y <= -800 && !check)
			{
				sm.setCurrentEffect("rgb", sf::seconds(1));
				check = true;
				timer.restart();SoundManager::instance().playNoiseSound();
			}
			if (check && timer.getElapsedTime().asSeconds() > 1)
			{
				first = false;
				MusicManager::instance().playMusicFast("battle");				
				pressFading = true;
			}
		}		
		else
		{
			pressFactor = 0.2;
			if (!pressFading)
			{
				pointer.setColor(sf::Color(255,255,255,interpolateLinear(pointer.getColor().a, 0,pressFactor)));
				if (pointer.getColor().a < 7)
				{
					pressFading = true;
				}
			}
			else
			{
				pointer.setColor(sf::Color(255,255,255,interpolateLinear(pointer.getColor().a, 255, pressFactor)));
				if (pointer.getColor().a > 243)
				{
					pressFading = false;
				}
			}

			switch (selection)
			{
			case 0:
				pointer.setPosition(1183, 415);
				break;
			case 1:
				pointer.setPosition(1183, 531);
				break;
			case 2:			
				pointer.setPosition(1183, 645);
				break;
			default:
				break;
			}
		}
	};
コード例 #10
0
ファイル: tile.hpp プロジェクト: silverhammermba/bananagrams
	inline const sf::Color& get_color() const
	{
		return sprite.getColor();
	}