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


C++ ObjectBase::drawSelectionBox方法代码示例

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


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

示例1: blitSelectionRects

void Tile::blitSelectionRects(int xPos, int yPos) {
    // draw underground selection rectangles
    if(hasAnUndergroundUnit() && !isFogged(pLocalHouse->getHouseID())) {
        UnitBase* current = getUndergroundUnit();

        if(current != NULL) {
            if(current->isVisible(pLocalHouse->getTeam()) && (location == current->getLocation())) {
                if(current->isSelected()) {
                    current->drawSelectionBox();
                }

                if(current->isSelectedByOtherPlayer()) {
                    current->drawOtherPlayerSelectionBox();
                }
            }
        }
    }


    // draw infantry selection rectangles
    if(hasInfantry() && !isFogged(pLocalHouse->getHouseID())) {
        std::list<Uint32>::const_iterator iter;
        for(iter = assignedInfantryList.begin(); iter != assignedInfantryList.end() ; ++iter) {
            InfantryBase* current = dynamic_cast<InfantryBase*>(currentGame->getObjectManager().getObject(*iter));

            if(current == NULL) {
                continue;
            }

            if(current->isVisible(pLocalHouse->getTeam()) && (location == current->getLocation())) {
                if(current->isSelected()) {
                    current->drawSelectionBox();
                }

                if(current->isSelectedByOtherPlayer()) {
                    current->drawOtherPlayerSelectionBox();
                }
            }
        }
    }

    // draw non infantry ground object selection rectangles
    if(hasANonInfantryGroundObject() && !isFogged(pLocalHouse->getHouseID())) {
        std::list<Uint32>::const_iterator iter;
        for(iter = assignedNonInfantryGroundObjectList.begin(); iter != assignedNonInfantryGroundObjectList.end() ; ++iter) {
            ObjectBase* current = currentGame->getObjectManager().getObject(*iter);

            if(current == NULL) {
                continue;
            }

            if(current->isVisible(pLocalHouse->getTeam()) && (location == current->getLocation())) {
                if(current->isSelected()) {
                    current->drawSelectionBox();
                }

                if(current->isSelectedByOtherPlayer()) {
                    current->drawOtherPlayerSelectionBox();
                }
            }
        }
    }

    // draw air unit selection rectangles
    if(hasAnAirUnit() && !isFogged(pLocalHouse->getHouseID())) {
        std::list<Uint32>::const_iterator iter;
        for(iter = assignedAirUnitList.begin(); iter != assignedAirUnitList.end() ; ++iter) {
            AirUnit* airUnit = dynamic_cast<AirUnit*>(currentGame->getObjectManager().getObject(*iter));

            if(airUnit == NULL) {
                continue;
            }

            if(airUnit->isVisible(pLocalHouse->getTeam()) && (location == airUnit->getLocation())) {
                if(airUnit->isSelected()) {
                    airUnit->drawSelectionBox();
                }

                if(airUnit->isSelectedByOtherPlayer()) {
                    airUnit->drawOtherPlayerSelectionBox();
                }
            }
        }
    }
}
开发者ID:binarycrusader,项目名称:dunelegacy,代码行数:85,代码来源:Tile.cpp


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