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


C++ IAction::Initialize方法代码示例

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


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

示例1: NextStep

    bool NextStep() {
        if(actions_.Count() == 0) return false;
        List<Point>* prevPoints = points_[points_.Count() - 1];

        // Check if the next action should be executed.
        if(currentStep_ == currentAction_->Steps()) {
            // Skip over all connected actions.
            size_t nextPosition = currentPosition_ + 1;
            while(nextPosition < actions_.Count() && actions_[nextPosition]->WithPrevious()) {
                nextPosition++;
            }

            size_t i = nextPosition + 1;
            while((i < actions_.Count()) && actions_[i]->WithPrevious()) {
                actions_[i]->Initialize(*prevPoints);
                i++;
            }

            if(nextPosition < actions_.Count()) {
                // Advance to the next action.
                currentAction_ = actions_[nextPosition];
                currentAction_->Initialize(*prevPoints);
                currentPosition_ = nextPosition;
                currentStep_ = 0;
            }
            else {
                // All actions have been executed.
                return false; 
            }
        }

        // Compute the next state of the shape.
        // The generated points depend directly on the previous ones.
        List<Point>* newPoints = new List<Point>(*prevPoints);
        points_.Add(newPoints);

        // Apply to the points the current action and all actions liked with it.
        currentAction_->Execute(currentStep_, *newPoints);

        for(size_t i = currentPosition_ + 1; i < actions_.Count(); i++) {
            if(actions_[i]->WithPrevious()) {
                actions_[i]->Execute(currentStep_, *newPoints);
            }
            else break;
        }

        currentStep_++;
        return true;
    }
开发者ID:UIKit0,项目名称:ObjectExtrusion3D,代码行数:49,代码来源:Storyboard.hpp

示例2: Play

    void Play() {
        if(actions_.Count() == 0) return;

        currentAction_ = actions_[0];
        currentPosition_ = 0;
        currentStep_ = 0;

        List<Point> *firstPoints = new List<Point>(shape_->Points());
        points_.Add(firstPoints);

        // Initialize the start action and the ones connected to it.
        currentAction_->Initialize(*firstPoints);

        for(size_t i = 1; i < actions_.Count(); i++) {
            if(actions_[i]->WithPrevious() == false) return;
            actions_[i]->Initialize(*firstPoints);
        }
    }
开发者ID:UIKit0,项目名称:ObjectExtrusion3D,代码行数:18,代码来源:Storyboard.hpp


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