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


C++ Being::drawSpeech方法代码示例

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


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

示例1: draw


//.........这里部分代码省略.........
        }
        if (player_y < mPixelViewY - mScrollRadius)
        {
            mPixelViewY += (player_y - mPixelViewY + mScrollRadius) /
                            mScrollLaziness;
        }

        // manage shake effect
        for (ShakeEffects::iterator i = mShakeEffects.begin();
             i != mShakeEffects.end();
             i++)
        {
            // apply the effect to viewport
            mPixelViewX += i->x *= -i->decay;
            mPixelViewY += i->y *= -i->decay;
            // check death conditions
            if (abs(i->x) + abs(i->y) < 1.0f ||
                (i->duration > 0 && --i->duration == 0))
            {
                i = mShakeEffects.erase(i);
            }
        }
        lastTick++;
    }

    // Auto center when player is off screen
    if (        player_x - mPixelViewX > graphics->getWidth() / 2
            ||  mPixelViewX - player_x > graphics->getWidth() / 2
            ||  mPixelViewY - player_y > graphics->getHeight() / 2
            ||  player_y - mPixelViewY > graphics->getHeight() / 2
        )
    {
        mPixelViewX = player_x;
        mPixelViewY = player_y;
    };

    // Don't move camera so that the end of the map is on screen
    const int viewXmax =
        mMap->getWidth() * mMap->getTileWidth() - graphics->getWidth();
    const int viewYmax =
        mMap->getHeight() * mMap->getTileHeight() - graphics->getHeight();
    if (mMap)
    {
        if (mPixelViewX < 0)
            mPixelViewX = 0;
        if (mPixelViewY < 0)
            mPixelViewY = 0;
        if (mPixelViewX > viewXmax)
            mPixelViewX = viewXmax;
        if (mPixelViewY > viewYmax)
            mPixelViewY = viewYmax;
    }

    // Draw tiles and sprites
    if (mMap)
    {
        mMap->draw(graphics, (int) mPixelViewX, (int) mPixelViewY);

        if (mDebugFlags)
        {
            if (mDebugFlags & (Map::MAP_GRID | Map::MAP_COLLISION_TILES))
            {
                mMap->drawCollision(graphics, (int) mPixelViewX,
                                    (int) mPixelViewY, mDebugFlags);
            }

            _drawDebugPath(graphics);
        }
    }

    if (player_node->getCheckNameSetting())
    {
        player_node->setCheckNameSetting(false);
        player_node->setName(player_node->getName());
    }

    // Draw text
    if (textManager)
    {
        textManager->draw(graphics, (int) mPixelViewX, (int) mPixelViewY);
    }

    // Draw player names, speech, and emotion sprite as needed
    const ActorSprites &actors = actorSpriteManager->getAll();
    for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end();
         it != it_end; it++)
    {
        if ((*it)->getType() == ActorSprite::FLOOR_ITEM)
            continue;

        Being *b = static_cast<Being*>(*it);
        b->drawSpeech((int) mPixelViewX, (int) mPixelViewY);
    }

    if (miniStatusWindow)
        miniStatusWindow->drawIcons(graphics);

    // Draw contained widgets
    WindowContainer::draw(gcnGraphics);
}
开发者ID:mobilehub,项目名称:mana,代码行数:101,代码来源:viewport.cpp


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