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


C++ Proxy::addChild方法代码示例

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


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

示例1: testUndo


//.........这里部分代码省略.........
    m.translate(100, 0, 0);
    proxyUndoWorld->setTransformation(m);
    undoWorld.undoStep();
    CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));

    // undo multiple setTransformation()
    m = Matrix();
    m.translate(100, 0, 0);
    proxyUndoWorld->setTransformation(m);
    m.translate(0, 50, 0);
    proxyUndoWorld->setTransformation(m);
    undoWorld.undoStep();
    CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));

    // undo setProxyType()
    proxyUndoWorld->setProxyType(PROXYTYPE_DEFORMABLE);
    undoWorld.undoStep();
    CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));

    // undo multiple setProxyType()
    proxyUndoWorld->setProxyType(PROXYTYPE_DEFORMABLE);
    proxyUndoWorld->setProxyType(PROXYTYPE_FIXED);
    undoWorld.undoStep();
    CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));


    ////////////////////////////////////////////////////////////////
    // build up a simple hierarchy with static + non-static children
    ////////////////////////////////////////////////////////////////
    Proxy* staticChildUndoWorld = undoWorld.createProxy(new Box(10, 10, 10));
    Proxy* staticChildReferenceWorld = referenceWorld.createProxy(new Box(10, 10, 10));
    staticChildUndoWorld->translate(40, 10, 10);
    staticChildReferenceWorld->translate(40, 10, 10);
    proxyUndoWorld->addChild(staticChildUndoWorld);
    proxyReferenceWorld->addChild(staticChildReferenceWorld);

    Proxy* childUndoWorld = undoWorld.createProxy(new Box(10, 10, 10));
    Proxy* childReferenceWorld = referenceWorld.createProxy(new Box(10, 10, 10));
    childUndoWorld->translate(0, 0, 10);
    childReferenceWorld->translate(0, 0, 10);
    childUndoWorld->rotate(100, 0, 0, 1);
    childReferenceWorld->rotate(100, 0, 0, 1);
    proxyUndoWorld->addChild(childUndoWorld);
    proxyReferenceWorld->addChild(childReferenceWorld);

    Proxy* staticGrandChildUndoWorld = undoWorld.createProxy(new Box(10, 10, 10));
    Proxy* staticGrandChildReferenceWorld = referenceWorld.createProxy(new Box(10, 10, 10));
    staticGrandChildUndoWorld->translate(20, 10, 10);
    staticGrandChildReferenceWorld->translate(20, 10, 10);
    childUndoWorld->addChild(staticGrandChildUndoWorld);
    childReferenceWorld->addChild(staticGrandChildReferenceWorld);
    ////////////////////////////////////
    // build up a simple hierarchy (end)
    ////////////////////////////////////

    // sanity check
    CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));

    // adding child proxies should not have any influence on undo, i.e. undo
    // should be a noop here.
    undoWorld.undoStep();
    CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));

    Proxy* dummyUndoProxy = undoWorld.createProxy(new Box(10, 10, 10));
    Proxy* dummyReferenceProxy = referenceWorld.createProxy(new Box(10, 10, 10));
    undoWorld.addProxy(dummyUndoProxy);
开发者ID:ColinGilbert,项目名称:d-collide,代码行数:67,代码来源:undotest.cpp


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