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


C++ Text::SetCharacterSize方法代码示例

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


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

示例1: main

int main()
{
    enum GameState
    {
        MainMenu,
        Playing,
        GameOver
    };

    GameState state = GameState::MainMenu;
    VideoMode videoMode(SCREEN_WIDTH, SCREEN_HEIGHT);
    RenderWindow renderWindow(videoMode, "SFML Tetris");
    Event gameEvent;
    Texture backgroundTexture;
    Texture brickPreviewBackground;
    Texture gameOverBackground;
    Texture mainMenuBackground;
    Sprite mainMenuBackgroundSprite;
    Sprite brickPreviewSprite;
    Sprite backgroundSprite;
    Sprite gameOverBackgroundSprite;
    SoundBuffer dropSoundBuffer;
    Sound dropSound;
    Music music;
    Text scoreHeaderText("Score: ");
    Text scoreDisplayText;
    Text levelHeaderText("Level: ");
    Text levelDisplayText;
    Text nextBrickText("Next: ");
    Text gameOverHeaderText("\t  GAME OVER!\nHere are your final stats:");
    Text mainMenuHeaderText("SFML TETRIS!");
    Text mainMenuStartText("Start");
    Text mainMenuQuitText("Quit");
    Text brickCountText[NUMBER_OF_BRICK_TYPES];
    bool gameBoard[GB_HEIGHT][GB_WIDTH];
    unsigned int score = 0;
    unsigned int level = 1;
    unsigned int totalLines = 0;
    unsigned int brickCount[NUMBER_OF_BRICK_TYPES] = {0};
    vector<Brick> brickQueue;
    vector<Brick> brickList;
    Clock brickLockTimer;
    Clock brickFallTimer;
    bool isCheckingLockTime = false;

    backgroundTexture.LoadFromFile("Images/background.png");
    brickPreviewBackground.LoadFromFile("Images/previewBG.png");
    gameOverBackground.LoadFromFile("Images/gameOverBG.png");
    mainMenuBackground.LoadFromFile("Images/mainMenuBG.png");

    brickPreviewSprite.SetTexture(brickPreviewBackground);
    brickPreviewSprite.SetPosition(450, 150);

    backgroundSprite.SetTexture(backgroundTexture);

    gameOverBackgroundSprite.SetTexture(gameOverBackground);
    gameOverBackgroundSprite.SetPosition(110, 82);

    mainMenuBackgroundSprite.SetTexture(mainMenuBackground);

    scoreHeaderText.SetCharacterSize(TEXT_CHAR_SIZE);
    scoreHeaderText.SetPosition(450, 20);

    char* scoreDisplayBuffer = new char;
    scoreDisplayText.SetCharacterSize(TEXT_CHAR_SIZE);
    scoreDisplayText.SetPosition(520, 20);

    levelHeaderText.SetCharacterSize(TEXT_CHAR_SIZE);
    levelHeaderText.SetPosition(450, 60);

    char* levelDisplayBuffer = new char;
    levelDisplayText.SetCharacterSize(TEXT_CHAR_SIZE);
    levelDisplayText.SetPosition(520, 60);

    nextBrickText.SetCharacterSize(TEXT_CHAR_SIZE);
    nextBrickText.SetPosition(450, 120);

    gameOverHeaderText.SetCharacterSize(TEXT_CHAR_SIZE);
    gameOverHeaderText.SetPosition(210, 265);

    mainMenuHeaderText.SetCharacterSize(40);
    mainMenuHeaderText.SetPosition(180, 50);

    mainMenuStartText.SetCharacterSize(32);
    mainMenuStartText.SetPosition(285, 210);

    mainMenuQuitText.SetCharacterSize(32);
    mainMenuQuitText.SetPosition(285, 310);

    char* brickCountTextBuffer[NUMBER_OF_BRICK_TYPES];
    for (int i = 0; i < NUMBER_OF_BRICK_TYPES; i++)
    {
        brickCountTextBuffer[i] = new char;
        brickCountText[i].SetPosition(100, 50 * (i + 1));
    }

    dropSoundBuffer.LoadFromFile("Sounds/drop.wav");
    dropSound.SetBuffer(dropSoundBuffer);

    for (int i = 0; i < GB_HEIGHT; i++)
//.........这里部分代码省略.........
开发者ID:GibsonT,项目名称:SFML-Tetris,代码行数:101,代码来源:main.cpp

示例2: AddContact

void PhoneModeAddressBook::AddContact(uint8_t Index)
{
    uint16_t AddressMask = 1 << Index;
    if (this->AddressMask & AddressMask)
        return;

    string Name = sExe->ReadStringIndirect(VA_PHONE_ADDRMENU, Index, 0xC, 0x4);
    Text ContactText;
    ContactText.SetPosition(PHONE_WALLPAPER_X, BLUE_HEADER_POS_Y + BLUE_HEADER_HEIGHT + Contacts.size() * 20);
    ContactText.SetColor(Nsb::Color::BLACK);
    ContactText.SetCharacterSize(20);
    ContactText.CreateFromString(Name);
    Contacts.push_back({ ContactText, Index });
    this->AddressMask |= AddressMask;
}
开发者ID:FGRE,项目名称:steins-gate-new,代码行数:15,代码来源:PhoneModeAddressBook.cpp


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