本文整理汇总了C++中sf::Sprite::SetColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Sprite::SetColor方法的具体用法?C++ Sprite::SetColor怎么用?C++ Sprite::SetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::Sprite
的用法示例。
在下文中一共展示了Sprite::SetColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void init(){
_backgroundImage.LoadFromFile("assets/wood-puzzle-floor.png");
_backgroundSprite.SetImage(_backgroundImage);
_robotImage.LoadFromFile("assets/roomba.png");
_robotSprite.SetImage(_robotImage);
_robotSprite.SetCenter(_robotSprite.GetSize().x/2, _robotSprite.GetSize().y/2);
_fakeRobotSprite.SetImage(_robotImage);
_fakeRobotSprite.SetCenter(_fakeRobotSprite.GetSize().x/2, _fakeRobotSprite.GetSize().y/2);
_fakeRobotSprite.SetColor(sf::Color(100,100,255));
_landmarkImage.LoadFromFile("assets/landmark.png");
_landmarkSprite.SetImage(_landmarkImage);
_landmarkSprite.SetCenter(_landmarkSprite.GetSize().x/2, _landmarkSprite.GetSize().y/2);
_rangeImage.LoadFromFile("assets/range.png");
_rangeSprite.SetImage(_rangeImage);
original_range_sprite_size_x = _rangeSprite.GetSize().x;
original_range_sprite_size_y = _rangeSprite.GetSize().y;
updateRangeSpriteScale();
_rangeSprite.SetCenter((original_range_sprite_size_x/2), (original_range_sprite_size_y/2));
_window.Create(sf::VideoMode(window_width,window_height,32), "Bearing simulator");
move_amount = 0;
rotation_amount = 0;
time_to_capture = false;
walk = 0;
rotation = 0;
}
示例2: fadeTick
// ag is the alpha goal between 1 and 0
void fadeTick(float ag, float speed)
{
float alphaGoal = 255 * ag;
m_alpha -= speed * m_animTimer->GetElapsedTime();
if (m_alpha <= alphaGoal)
{
m_transitioning = NONE;
return;
}
m_transition.SetColor(sf::Color(0, 0, 0, m_alpha));
}