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


C++ AnimatedSprite::SetColor方法代码示例

本文整理汇总了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)
        };
//.........这里部分代码省略.........
开发者ID:svk,项目名称:fto-engine,代码行数:101,代码来源:test-hexfml.cpp


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