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


C++ TestScene类代码示例

本文整理汇总了C++中TestScene的典型用法代码示例。如果您正苦于以下问题:C++ TestScene类的具体用法?C++ TestScene怎么用?C++ TestScene使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: WinMain

int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
#endif
{
    // Initialize the environment.
    DMAPP_INIT();

    // Configuration
    DMAPP.GetConfig()->SetFullScreen(false);
    DMAPP.GetConfig()->SetShowMouse();

    // Initialize the app
    DMAPP.Initialize();

    // Create a scene and show it.
    TestScene* s = new TestScene();
    s->Initialize();
    DMSCENE.AddScene("test", s);
    DMSCENE.SetCurrentScene("test");

    // Start game.
    DMAPP.Start();

    // Shutdown after gaming.
    DMAPP.Shutdown();

    // You should clear scene before all cleaned.
    DMSCENE.ClearScenes();

    return 0;
}
开发者ID:XadillaX,项目名称:DMGameEngine,代码行数:30,代码来源:main.cpp

示例2: main

int main(int argc, char **argv) {
  TestScene *scene = new TestScene(argc, argv, std::min(1, argc - 1));
  options.parse(argc, argv);

  size_t count = 0;

  carve::input::Input inputs;
  std::vector<carve::poly::Polyhedron *> polys;
  std::vector<carve::line::PolylineSet *> lines;
  std::vector<carve::point::PointSet *> points;

  // Test polyhedron


  carve::poly::Polyhedron *test1 = makeCube(-1,-1,-1,1,1,1);
  carve::poly::Polyhedron *test2 = makeCube(0,0,0,2,2,2);
  polys.push_back(test1);
  polys.push_back(test2);

  carve::csg::CSG testt;
  carve::poly::Polyhedron *test3 = testt.compute(test1, test2, carve::csg::CSG::INTERSECTION);
  polys.push_back(test3);

  scene->draw_list_base = genSceneDisplayList(polys, lines, points, &count, scene->is_wireframe);
  scene->draw_flags.assign(count, true);

  scene->run();

  delete scene;

  return 0;
}
开发者ID:pigoblock,项目名称:TFYP,代码行数:32,代码来源:view.cpp

示例3: main

int main(int argc, char **argv) {
  carve::poly::Polyhedron *input = readPLY(argv[1]);
  double offset = strtod(argv[2], NULL);

  TestScene *scene = new TestScene(argc, argv, 3);

  glNewList(scene->draw_list_base, GL_COMPILE);
  doOffset(input, offset);
  glEndList();

  glNewList(scene->draw_list_base + 1, GL_COMPILE);
  drawPolyhedron(input, .6, .6, .6, 1.0, false);
  glEndList();

  glNewList(scene->draw_list_base + 2, GL_COMPILE);
  drawPolyhedronWireframe(input);
  glEndList();

  scene->draw_flags[0] = true;
  scene->draw_flags[1] = true;
  scene->draw_flags[2] = true;

  scene->run();

  delete scene;

  return 0;
}
开发者ID:dbc,项目名称:pyPolyCSG,代码行数:28,代码来源:offset.cpp

示例4: scene

cocos2d::CCScene* CocoStudioAnimationTest::scene()
{
	TestScene* scene = TestScene::create();
	CocoStudioAnimationTest* layer = CocoStudioAnimationTest::create();
	scene->addChild(layer);
	return scene;
}
开发者ID:LiYuandong,项目名称:Cocos2dxTestProject,代码行数:7,代码来源:CocoStudioAnimationTest.cpp

示例5: scene

cocos2d::CCScene* PixelSpriteTest::scene()
{
	TestScene* scene = TestScene::create();
	PixelSpriteTest* layer = PixelSpriteTest::create();
	scene->addChild(layer);
	return scene;
}
开发者ID:LiYuandong,项目名称:Cocos2dxTestProject,代码行数:7,代码来源:PixelSpriteTest.cpp

示例6: TestScene

TestScene *TestScene::create(const Size3D &size)
{
	TestScene *scene = new TestScene();
	if(scene->initWithSize(size)){
		return scene;
	}
	delete scene;
	return NULL;
}
开发者ID:rocket99,项目名称:PEEngine,代码行数:9,代码来源:TestScene.cpp

示例7: switch

void ExtensionsMainLayer::menuCallback(CCObject* pSender)
{
    CCMenuItemFont* pItem = (CCMenuItemFont*)pSender;
    int nIndex = pItem->getZOrder() - kItemTagBasic;

    switch (nIndex)
    {
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)	// MARMALADE CHANGE: Not yet avaiable on Marmalade
    case TEST_NOTIFICATIONCENTER:
        {
            runNotificationCenterTest();
        }
        break;
#endif
    case TEST_CCCONTROLBUTTON:
        {
            CCControlSceneManager* pManager = CCControlSceneManager::sharedControlSceneManager();
            CCScene* pScene = pManager->currentControlScene();
            CCDirector::sharedDirector()->replaceScene(pScene);
        }
        break;
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)	// MARMALADE CHANGE: Not yet avaiable on Marmalade
    case TEST_COCOSBUILDER:
        {
            TestScene* pScene = new CocosBuilderTestScene();
            if (pScene)
            {
                pScene->runThisTest();
                pScene->release();
            }
        }
        break;
#endif
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)	// MARMALADE CHANGE: Not yet avaiable on Marmalade
    case TEST_HTTPCLIENT:
        {
            runHttpClientTest();
        }
        break;
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
    case TEST_EDITBOX:
        {
            runEditBoxTest();
        }
        break;
#endif
	case TEST_TABLEVIEW:
		{
			runTableViewTest();
		}
		break;
    default:
        break;
    }
}
开发者ID:PavolSatala,项目名称:cocos2d-x,代码行数:56,代码来源:ExtensionsTest.cpp

示例8: TestScene

TestScene* TestScene::Create()
{
	TestScene* ts = new TestScene();
	ts->AutoRelease();
	if (!ts->Init())
	{
		return NULL;
	}
	return ts;
}
开发者ID:tcye,项目名称:D3DEngine,代码行数:10,代码来源:TestScene.cpp

示例9: new

TestScene* TestScene::createWithPhysics()
{
	TestScene *ret = new (std::nothrow) TestScene();
	if (ret && ret->initWithPhysics())
	{
		ret->autorelease();
		return ret;
	}
	else
	{
		CC_SAFE_DELETE(ret);
		return nullptr;
	}
}
开发者ID:Totolin,项目名称:cultus-cocos2d,代码行数:14,代码来源:TestScene.cpp

示例10: menuCallback

void TestController::menuCallback(Object * pSender)
{

	Director::sharedDirector()->purgeCachedData();

    // get the userdata, it's the index of the menu item clicked
    MenuItem* pMenuItem = (MenuItem *)(pSender);
    int idx = pMenuItem->getZOrder() - 10000;

    // create the test scene and run it
    TestScene* pScene = g_aTestNames[idx].callback();

    if (pScene)
    {
        pScene->runThisTest();
        pScene->release();
    }
}
开发者ID:bassarisse,项目名称:LostInCaves,代码行数:18,代码来源:controller.cpp

示例11: switch

void ExtensionsMainLayer::menuCallback(CCObject* pSender)
{
    CCMenuItemFont* pItem = (CCMenuItemFont*)pSender;
    int nIndex = pItem->getZOrder() - kItemTagBasic;

    switch (nIndex)
    {
    case TEST_NOTIFICATIONCENTER:
        {
            runNotificationCenterTest();
        }
        break;
    case TEST_CCCONTROLBUTTON:
        {
            CCControlSceneManager* pManager = CCControlSceneManager::sharedControlSceneManager();
            CCScene* pScene = pManager->currentControlScene();
            CCDirector::sharedDirector()->replaceScene(pScene);
        }
        break;
    case TEST_TEXTUREWATCHER:
        {
            static bool s_bOpened = false;
            s_bOpened = !s_bOpened;
            CCTextureWatcher::sharedTextureWatcher()->setDisplayWatcher(s_bOpened);
        }
        break;
    case TEST_COCOSBUILDER:
        {
            TestScene* pScene = new CocosBuilderTestScene();
            if (pScene)
            {
                pScene->runThisTest();
                pScene->release();
            }
        }
        break;
    default:
        break;
    }
}
开发者ID:haiweizhang,项目名称:MyCocos2d-xV2.0,代码行数:40,代码来源:ExtensionsTest.cpp

示例12: create

Scene* TestScene::create()
{
	TestScene* scene = TestScene::createWithPhysics();
	scene->getPhysicsWorld()->setGravity(Vect(0.0f, -700.0f));
	scene->getPhysicsWorld()->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL);
	scene->scheduleUpdate();

	Size visibleSize = Director::getInstance()->getVisibleSize();
	Vec2 origin = Director::getInstance()->getVisibleOrigin();


	PhysicsBody* edgeBody = PhysicsBody::createEdgeBox(visibleSize, PhysicsMaterial(0.1f, 0.0f, 0.5f), 3);
	

	Node* edgeNode = Node::create();
	edgeNode->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));
	edgeNode->setPhysicsBody(edgeBody);
	

	scene->addChild(edgeNode);



	Player* sprite = Player::create();
	sprite->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));


	/*Sprite* sprite = Sprite::create("testSprite.png");
	sprite->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));
	MyBodyParser::getInstance()->parseJsonFile("test.json");

	auto spriteBody = MyBodyParser::getInstance()->bodyFormJson(sprite, "Test", PhysicsMaterial(1, 1, 0));

	if (spriteBody != nullptr)
	{
		spriteBody->setDynamic(true);
		sprite->setPhysicsBody(spriteBody);
	}*/

	scene->addChild(sprite);


	return scene;
}
开发者ID:Totolin,项目名称:cultus-cocos2d,代码行数:44,代码来源:TestScene.cpp

示例13: main

int main(int argc, char **argv) {
  TestScene *scene = new TestScene(argc, argv, 2);

  GLuint tex_1 = initTexture(128, 128, carve_texture);
  GLuint tex_2 = initTexture(128, 128, brick_texture);
  GLuint tex_3 = initTexture(128, 128, leaf_texture);

  g_scale = 10.0;

  carve::interpolate::FaceVertexAttr<tex_t> fv_tex;
  carve::interpolate::FaceAttr<GLuint> f_tex_num;
  carve::mesh::MeshSet<3> *base = NULL;

  bool b = true;
  for (int x = -10; x <= +10; x += 5) {
    for (int y = -10; y <= +10; y += 5) {
      for (int z = -10; z <= +10; z += 5) {
        double rot = x * .17 + y * .06 + z * .09;
        carve::mesh::MeshSet<3> *r = texturedCube(fv_tex, f_tex_num, b ? tex_2 : tex_3,
                                 carve::math::Matrix::TRANS(x/2.5, y/2.5, z/2.5) *
                                 carve::math::Matrix::ROT(rot, 1,2,3));
        b = !b;
        if (base) {
          carve::mesh::MeshSet<3> *temp = base;
          carve::csg::CSG csg;
          fv_tex.installHooks(csg);
          f_tex_num.installHooks(csg);

          base = csg.compute(temp, r, carve::csg::CSG::UNION);
          delete temp;
          delete r;
        } else {
          base = r;
        }
      }
    }
  }

  carve::mesh::MeshSet<3> *r1 = texturedCube(fv_tex, f_tex_num, tex_1,
                            carve::math::Matrix::TRANS(0,0,4) *
                            carve::math::Matrix::SCALE(4,4,4));

  carve::mesh::MeshSet<3> *r2 = texturedCube(fv_tex, f_tex_num, tex_1,
                            carve::math::Matrix::TRANS(0,0,5) *
                            carve::math::Matrix::SCALE(2, 2, 2));

  carve::csg::CSG csg;
  fv_tex.installHooks(csg);
  f_tex_num.installHooks(csg);

  carve::mesh::MeshSet<3> *r3 = csg.compute(base, r1, carve::csg::CSG::INTERSECTION, NULL, carve::csg::CSG::CLASSIFY_EDGE);
  carve::mesh::MeshSet<3> *r4 = csg.compute(r3, r2, carve::csg::CSG::UNION, NULL, carve::csg::CSG::CLASSIFY_EDGE);

  glNewList(scene->draw_list_base, GL_COMPILE);
  drawTexturedPolyhedron(r4, fv_tex, f_tex_num);
  glEndList();

  glNewList(scene->draw_list_base+1, GL_COMPILE);
  drawWireframePolyhedron(r3);
  glEndList();

  scene->draw_flags[0] = true;
  scene->draw_flags[1] = true;

  scene->run();

  destroyTexture(tex_1);
  destroyTexture(tex_2);
  destroyTexture(tex_3);

  delete scene;

  return 0;
}
开发者ID:ManojRollo,项目名称:carve,代码行数:74,代码来源:texture_example.cpp

示例14: main

int main(int argc, char **argv) {
  carve::mesh::MeshSet<3> *a = makeCube(carve::math::Matrix::ROT(1.0, 1.0, 1.0, 1.0));
  
  std::vector<carve::mesh::MeshSet<3>::vertex_t> shape;

  for (int i = 0; i < POINTS; ++i) {
    double r = 2.0 + .4 * sin(i * 3 * M_TWOPI / POINTS) + .8 * sin(i * 5 * M_TWOPI / POINTS);
    shape.push_back(carve::mesh::MeshSet<3>::vertex_t(carve::geom::VECTOR(r * cos(i * M_TWOPI / POINTS), r * sin(i * M_TWOPI / POINTS), 0.0)));
  }
  std::vector<carve::mesh::MeshSet<3>::vertex_t *> face_verts;
  for (int i = 0; i < POINTS; ++i) {
    face_verts.push_back(&shape[i]);
  }
  std::vector<carve::mesh::MeshSet<3>::face_t *> faces;
  faces.push_back(new carve::mesh::MeshSet<3>::face_t(face_verts.begin(), face_verts.end()));

  carve::mesh::MeshSet<3> *b = new carve::mesh::MeshSet<3>(faces);

  std::list<std::pair<carve::csg::FaceClass, carve::mesh::MeshSet<3> *> > b_sliced;

  carve::csg::CSG csg;

  csg.hooks.registerHook(new carve::csg::CarveTriangulator, carve::csg::CSG::Hooks::PROCESS_OUTPUT_FACE_BIT);
  csg.sliceAndClassify(a, b, b_sliced);

  TestScene *scene = new TestScene(argc, argv, 6);

  glNewList(scene->draw_list_base + 0, GL_COMPILE);

  drawMeshSet(a, .4, .6, .8, 1.0);
  glEndList();

  glNewList(scene->draw_list_base + 1, GL_COMPILE);
  drawMeshSet(b, .8, .6, .4, 1.0);
  glEndList();

  glNewList(scene->draw_list_base + 2, GL_COMPILE);
  {
    int n = 0;
    for (std::list<std::pair<carve::csg::FaceClass, carve::mesh::MeshSet<3> *> >::iterator i = b_sliced.begin(); i != b_sliced.end(); ++i) {
      float r, g, b;
      switch ((*i).first) {
      case carve::csg::FACE_IN:             r = 0.0; g = 0.0; b = 1.0; break;
      case carve::csg::FACE_OUT:            r = 1.0; g = 0.0; b = 0.0; break;
      case carve::csg::FACE_ON_ORIENT_OUT:  r = 1.0; g = 1.0; b = 0.0; break;
      case carve::csg::FACE_ON_ORIENT_IN:   r = 0.0; g = 1.0; b = 1.0; break;
      }
      drawMeshSet((*i).second, r, g, b, 1.0);
      ++n;
    }
  }
  glEndList();

  glNewList(scene->draw_list_base + 3, GL_COMPILE);
  {
    int n = 0;
    for (std::list<std::pair<carve::csg::FaceClass, carve::mesh::MeshSet<3> *> >::iterator i = b_sliced.begin(); i != b_sliced.end(); ++i) {
      float r, g, b;
      switch ((*i).first) {
      case carve::csg::FACE_IN:             r = 0.3; g = 0.3; b = 0.7; break;
      case carve::csg::FACE_OUT:            r = 0.7; g = 0.3; b = 0.3; break;
      case carve::csg::FACE_ON_ORIENT_OUT:  r = 0.7; g = 0.7; b = 0.3; break;
      case carve::csg::FACE_ON_ORIENT_IN:   r = 0.3; g = 0.7; b = 0.7; break;
      }
      drawMeshSetWireframe((*i).second, -1, false, false);
      ++n;
    }
  }
  glEndList();

  scene->run();

  delete scene;

  return 0;
}
开发者ID:ManojRollo,项目名称:carve,代码行数:76,代码来源:test_slice_classify.cpp

示例15: warning

#include <vector>

#ifdef _MSC_VER
#pragma warning(push, 0)
#include <catch.hpp>
#pragma warning(pop)
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wall"
#include <catch.hpp>
#pragma GCC diagnostic pop
#endif

TEST_CASE("DetourPipelineTest/Pipeline", "Tests about the pipeline behavior")
{
	TestScene ts;
	dtCrowd* crowd = ts.createSquareScene(20, 0.5);

	REQUIRE(crowd != 0);

	dtPipelineBehavior* pipeline = dtPipelineBehavior::allocate();

	float posAgt1[] = {0, 0.2f, 0};
	float destAgt1[] = {15, 0, 0};

	dtCrowdAgent ag;

	// Adding the agents to the crowd
	REQUIRE(crowd->addAgent(ag, posAgt1));
	ts.defaultInitializeAgent(*crowd, ag.id);
开发者ID:LEgregius,项目名称:recastdetour,代码行数:30,代码来源:DetourPipelineTest.cpp


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