本文整理汇总了C++中AnimatedSprite::SetColor方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimatedSprite::SetColor方法的具体用法?C++ AnimatedSprite::SetColor怎么用?C++ AnimatedSprite::SetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimatedSprite
的用法示例。
在下文中一共展示了AnimatedSprite::SetColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[]) {
using namespace std;
ResourceManager<sf::Image> images;
ResourceManager<HexSprite> hexSprites;
ResourceManager<sf::SoundBuffer> soundBuffers;
ScreenGrid grid ( "./data/hexproto2.png" );
hexSprites.bind( "black", new HexSprite( "./data/hexblack2.png", grid ) );
hexSprites.bind( "white", new HexSprite( "./data/hexwhite2.png", grid ) );
hexSprites.bind( "gray", new HexSprite( "./data/hexgray2grid.png", grid ) );
// hexSprites.bind( "red", new HexSprite( "./data/hexred1.png", grid ) );
// hexSprites.bind( "blue", new HexSprite( "./data/hexblue1.png", grid ) );
// hexSprites.bind( "rainbow", new HexSprite( "./data/hexrainbow1.png", grid ) );
hexSprites.bind( "yellow-border", new HexSprite( "./data/hexborder2.png", grid ) );
hexSprites.bind( "white-black-edge", new HexSprite( "./data/hexwhiteblack2.png", grid ) );
hexSprites.bind( "black-white-edge", new HexSprite( "./data/hexblackwhite2.png", grid ) );
soundBuffers.bind( "fail-sound", new sf::SoundBuffer() );
soundBuffers["fail-sound"].LoadFromFile( "./data/fail.wav" );
bool showingKitten = false;
HexViewport viewport (grid, 10,10,700,800);
viewport.setNoBackgroundColour();
sf::RenderWindow win ( sf::VideoMode(800,600,32),
"521 HexFML" );
sf::Clock clock;
sf::Image hexBorderImage;
if( !hexBorderImage.LoadFromFile( "./data/hexborder1.png" ) ) {
throw std::runtime_error( "unable to load hex border" );
}
sf::Sprite hexBorder;
hexBorderImage.SetSmooth( false );
hexBorder.SetImage( hexBorderImage );
sf::View mainView ( sf::Vector2f( 0, 0 ),
sf::Vector2f( 400, 300 ) );
win.SetView( mainView );
sf::Image kittenImage;
if( !kittenImage.LoadFromFile( "./data/minikitten.png" ) ) {
throw std::runtime_error( "unable to find kitten" );
}
sf::Image kittenRednoseImage;
if( !kittenRednoseImage.LoadFromFile( "./data/minikitten-clownnose.png" ) ) {
throw std::runtime_error( "unable to find kitten-clown" );
}
sf::Sprite kittenSprite;
kittenSprite.SetImage( kittenImage );
kittenSprite.SetColor( sf::Color(255,255,255,225) );
ViewportMouseScroller * vpMouseScroller = 0;
FreetypeLibrary freetypeLib;
FreetypeFace myFtFont ("./data/CrimsonText-Bold.otf", 20);
LabelSprite helloWorldSprite ("What are you trying to find? I don't care, I'm not kind -- I have bludgeoned your sailors, spat out their keepsakes.",
sf::Color(192,72,72),
myFtFont );
sf::Color red(255,0,0);
sf::Color white(255,255,255);
ChatBox chatbox ( 0, 0, 640, 480, myFtFont, sf::Color(0,0,0) );
sf::Image *textPopup = 0;
{
int popupWidth = 320;
int spacing = 8;
SfmlRectangularRenderer rr ( popupWidth, spacing, TJM_PAD );
WordWrapper wrap ( rr, popupWidth, spacing );
std::string texts[] = {
"I have never had a way with ",
"women",
", but the hills of ",
"Iowa",
" make me wish that I could. And I have never found a way to say ",
"\"I love you\"",
", but if the chance came by, oh I, I ",
"would",
". But way back where I come from, we never mean to bother, we " \
"don't like to make our passions other people's concern, " \
"and we walk in the world of safe people, " \
"and at night we walk into our houses and burn."
};
sf::Color colours[] = {
sf::Color(255,255,255),
sf::Color(255,0,0),
sf::Color(255,255,255),
sf::Color(0,0,255),
sf::Color(255,255,255),
sf::Color(255,0,0),
sf::Color(255,255,255),
sf::Color(0,0,255),
sf::Color(255,255,255)
};
//.........这里部分代码省略.........