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


C++ Font::loadFromStream方法代码示例

本文整理汇总了C++中sf::Font::loadFromStream方法的典型用法代码示例。如果您正苦于以下问题:C++ Font::loadFromStream方法的具体用法?C++ Font::loadFromStream怎么用?C++ Font::loadFromStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sf::Font的用法示例。


在下文中一共展示了Font::loadFromStream方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char** argv)
{
    new Engine();
    new DirectoryResourceProvider("resources/");
    textureManager.setDefaultSmooth(true);
    textureManager.setDefaultRepeated(true);
    textureManager.setAutoSprite(false);

    //Setup the rendering layers.
    backgroundLayer = new RenderLayer();
    objectLayer = new RenderLayer(backgroundLayer);
    effectLayer = new RenderLayer(objectLayer);
    hudLayer = new RenderLayer(effectLayer);
    mouseLayer = new RenderLayer(hudLayer);
    glitchPostProcessor = new PostProcessor("glitch", mouseLayer);
    glitchPostProcessor->enabled = false;
    defaultRenderLayer = objectLayer;

    int width = 1600;
    int height = 900;
    int fsaa = 0;
    bool fullscreen = true;
#ifdef DEBUG
    fullscreen = false;
#endif
    engine->registerObject("windowManager", new WindowManager(width, height, fullscreen, glitchPostProcessor, fsaa));
    engine->registerObject("mouseRenderer", new MouseRenderer());
    soundManager.setMusicVolume(50);

    randomNebulas();
    
    P<ResourceStream> stream = getResourceStream("sansation.ttf");
    mainFont.loadFromStream(**stream);

    P<ResourceStream> vertexStream = getResourceStream("objectShader.vert");
    P<ResourceStream> fragmentStream = getResourceStream("objectShader.frag");
    objectShader.loadFromStream(**vertexStream, **fragmentStream);
    vertexStream = getResourceStream("basicShader.vert");
    fragmentStream = getResourceStream("basicShader.frag");
    basicShader.loadFromStream(**vertexStream, **fragmentStream);
    
    P<ScriptObject> shipTemplatesScript = new ScriptObject("shipTemplates.lua");
    shipTemplatesScript->destroy();
    
    factionInfo[0].name = "Neutral";
    factionInfo[1].name = "Human";
    factionInfo[2].name = "SpaceCow";
    factionInfo[3].name = "Sheeple";
    factionInfo[4].name = "PirateScorpions";
    factionInfo[0].gm_color = sf::Color(128, 128, 128);
    factionInfo[1].gm_color = sf::Color(255, 255, 255);
    factionInfo[2].gm_color = sf::Color(255, 0, 0);
    factionInfo[3].gm_color = sf::Color(255, 128, 0);
    factionInfo[4].gm_color = sf::Color(255, 0, 128);
    FactionInfo::setState(0, 4, FVF_Enemy);

    FactionInfo::setState(1, 2, FVF_Enemy);
    FactionInfo::setState(1, 3, FVF_Enemy);
    FactionInfo::setState(1, 4, FVF_Enemy);
    
    FactionInfo::setState(2, 3, FVF_Enemy);
    FactionInfo::setState(2, 4, FVF_Enemy);
    FactionInfo::setState(3, 4, FVF_Enemy);
    
    new MainMenu();
    
    engine->runMainLoop();
    
    delete engine;
    return 0;
}
开发者ID:,项目名称:,代码行数:71,代码来源:


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