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


C++ BaseSprite::GetHeight方法代码示例

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


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

示例1: Setup

void GameGrid::Setup()
{
    blockTexture = Engine->Graphics->CreateTexture();
    blockTexture->Initalize(BlockSize, BlockSize);
    blockTexture->SetSolidColor(0xFF0000FF);

    rng = new WeightedNumberGenerator();
    rng->AddBucket(0, 0.20);
    rng->AddBucket(1, 0.75);
    rng->AddBucket(2, 0.05);

    for (int i = 0; i < SquareSize; i++) // Y
    {
        for (int j = 0; j < SquareSize; j++) // X
        {
            GridTile* newTile = new GridTile(rng->GetNext(), this->Engine);

            newTile->MoveTo(j * BlockSize + (j * SpaceSize) + GridOffsetPosX, i * BlockSize + (i * SpaceSize) + GridOffsetPosY);

            this->Tiles->Add(newTile);

            this->Engine->AttachActor(newTile);
        }
    }

    // Placing the InfoTiles for the rows (at the right)
    for (int i = 0; i < SquareSize; i++)
    {
        BaseSprite* rightMostTile = this->Tiles->Get(i * SquareSize + SquareSize - 1)->TileSprite;

        FPosition rightMostPosition = rightMostTile->GetOffsetPos();

        FPosition posOffset = rightMostPosition;
        posOffset.X += rightMostTile->GetWidth() + 10;

        InfoTile* info = new InfoTile(GetZeroesOfRow(i), GetSumOfRow(i), this->Engine);
        InfoTiles->Add(info);
        
        Engine->AttachActor(info);

        info->MoveTo(posOffset.X, posOffset.Y);
    }

    // Placing the InfoTiles for the columns (at the bottom)
    for (int j = 0; j < SquareSize; j++)
    {
        BaseSprite* bottomMostTile = this->Tiles->Get(SquareSize * SquareSize - SquareSize + j)->TileSprite;

        FPosition bottomMostPosition = bottomMostTile->GetOffsetPos();
        
        FPosition posOffset = bottomMostPosition;
        posOffset.Y += bottomMostTile->GetHeight() + 10;

        InfoTile* info = new InfoTile(GetZeroesOfColumn(j), GetSumOfColumn(j), this->Engine);
        InfoTiles->Add(info);
        Engine->AttachActor(info);

        info->MoveTo(posOffset.X, posOffset.Y);
    }

    gameTitleText = Engine->CreateText("Down & Across");
    gameTitleText->SetCharacterSize(32);
    gameTitleText->SetPos(10, 0);
    gameTitleText->SetColor(0xFFFFFFFF);

    currentLevelLabel = Engine->CreateText("Level 1");
    currentLevelLabel->SetCharacterSize(32);
    currentLevelLabel->SetPos(300, 0);
    currentLevelLabel->SetColor(0xFFFFFFFF);

    currentLevelScore = Engine->CreateText("0");
    currentLevelScore->SetCharacterSize(72);
    currentLevelScore->SetPos(0, 520);
    currentLevelScore->SetColor(0xFFFFFFFF);

    currentLevelScoreExplain = Engine->CreateText("Current Level Score");
    currentLevelScoreExplain->SetCharacterSize(12);
    currentLevelScoreExplain->SetPos(5, 525);
    currentLevelScoreExplain->SetColor(0xFFFFFFFF);

    totalScoreText = Engine->CreateText("0");
    totalScoreText->SetCharacterSize(72);
    totalScoreText->SetPos(300, 520);
    totalScoreText->SetColor(0xFFFFFFFF);

    totalScoreExplain = Engine->CreateText("Total Score");
    totalScoreExplain->SetCharacterSize(12);
    totalScoreExplain->SetPos(305, 525);
    totalScoreExplain->SetColor(0xFFFFFFFF);


    btnNextLevel = Engine->CreateSprite("btnNextLevel", "assets\\Button_NextLevel.png");
    btnNextLevel->SetScale(0.5);

    FPosition targetPos = InfoTiles->Get(InfoTiles->Count() - 1)->BackgroundSprite->GetOffsetPos();
    targetPos.X += 64 + 10;
    btnNextLevel->SetPos(targetPos);

    // Message setup
    LevelCompleteMessage = new GameMessageWindow();
//.........这里部分代码省略.........
开发者ID:kratosaurion7,项目名称:CommsFramework,代码行数:101,代码来源:GameGrid.cpp


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