本文整理汇总了C++中sf::Sprite::getColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Sprite::getColor方法的具体用法?C++ Sprite::getColor怎么用?C++ Sprite::getColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::Sprite
的用法示例。
在下文中一共展示了Sprite::getColor方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: manageHit
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: fadeSpriteOut
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: fadeSpriteIn
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: fadeReference
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: replaceFrame
void AnimatedSprite::replaceFrame(sf::Sprite sprite, unsigned int frame)
{
if(frame < m_numFrames)
{
m_sprites[frame] = sprite;
m_spriteColors[frame] = sprite.getColor();
}
}
示例6: insertFrame
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:
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: pushFrame
void AnimatedSprite::pushFrame(sf::Sprite sprite)
{
m_sprites.push_back(sprite);
m_spriteColors.push_back(sprite.getColor());
m_numFrames++;
}
示例9: update
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:
inline const sf::Color& get_color() const
{
return sprite.getColor();
}