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


C++ Object2D类代码示例

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


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

示例1:

void RigidMatrixTransformation2DTest::resetTransformation() {
    Object2D o;
    o.setTransformation(Matrix3::rotation(Deg(17.0f)));
    CORRADE_VERIFY(o.transformationMatrix() != Matrix3());
    o.resetTransformation();
    CORRADE_COMPARE(o.transformationMatrix(), Matrix3());
}
开发者ID:ariosx,项目名称:magnum,代码行数:7,代码来源:RigidMatrixTransformation2DTest.cpp

示例2: resetTransformation

void TranslationTransformationTest::resetTransformation() {
    Object2D o;
    o.setTransformation({1.0f, -0.3f});
    CORRADE_VERIFY(o.transformationMatrix() != Matrix3());
    o.resetTransformation();
    CORRADE_COMPARE(o.transformationMatrix(), Matrix3());
}
开发者ID:awoland,项目名称:magnum,代码行数:7,代码来源:TranslationTransformationTest.cpp

示例3: resetTransformation

void DualComplexTransformationTest::resetTransformation() {
    Object2D o;
    o.setTransformation(DualComplex::rotation(Deg(17.0f)));
    CORRADE_VERIFY(o.transformationMatrix() != Matrix3());
    o.resetTransformation();
    CORRADE_COMPARE(o.transformationMatrix(), Matrix3());
}
开发者ID:DYSEQTA,项目名称:magnum,代码行数:7,代码来源:DualComplexTransformationTest.cpp

示例4: drawObjects

void drawObjects(Logic* logic, Render* render) {
    // draw background
    render->drawSprite(ObjectType::backgnd, 0, 0);

    // draw bombs
    Object1D bombs = logic->getBombs();
    for(Object1D::iterator it1D = bombs.begin(); it1D != bombs.end(); ++it1D)
        render->drawSprite((*it1D).type, (*it1D).position); 

    // draw rockets
    Object1D rockets = logic->getRockets();
    for(Object1D::iterator it1D = rockets.begin(); it1D != rockets.end(); ++it1D)
        render->drawSprite((*it1D).type, (*it1D).position); 

    // draw enemies
    Object2D enemies = logic->getEnemies();
    for(Object2D::iterator it2D = enemies.begin(); it2D != enemies.end(); ++it2D)
        for(Object1D::iterator it1D = (*it2D).begin(); it1D != (*it2D).end(); ++it1D)
            render->drawSprite((*it1D).type, (*it1D).position);

    // draw player
    render->drawSprite(ObjectType::player, logic->getPlayer().position);
            
    //draw stats
    render->drawLifes(logic->getLifes());
    render->drawScore(logic->getScore());
}
开发者ID:asibilev,项目名称:invaders,代码行数:27,代码来源:main.cpp

示例5: AssociateShapesCallback

void Renderer::AssociateShapesCallback(string arg)
{
	if (selectedShapes.size() <= 1)
		return;
	Object2D* parent;
	if (parent = dynamic_cast<Object2D*>(selectedShapes.front()))
	{
		std::vector<Shape*>::iterator itr = selectedShapes.begin();
		itr++;
		for (itr; itr != selectedShapes.end(); ++itr)
		{
			Object2D* child;
			if (child = dynamic_cast<Object2D*>(*itr))
			{
				parent->AddChild(child);
			}
		}
		clearSelectedShapes();
    }

}
开发者ID:LordCatzorz,项目名称:IFT-3100-TP,代码行数:21,代码来源:Renderer.cpp

示例6: Rectangle2D

void Scene2D::initialize()
{
	Object2D* obj = new Rectangle2D(3.0, 4.0);
	obj->setLineColor(0x0000ff);
	obj->setFillColor(0xff00ff);
	obj->rotate(30);
	objects_.push_back(obj);

	obj = new Rectangle2D(5.0, 2.0);
	obj->setLineColor(0x000000);
	obj->setFillColor(0x00ffff);
	objects_.push_back(obj);

	obj = new Ellipse2D(4.0, 2.0);
	obj->rotate(-20);
	obj->translate( 3.0, -3.0);
	obj->setFillColor(0xffff00);
	objects_.push_back(obj);
}
开发者ID:rumpfc,项目名称:CGG,代码行数:19,代码来源:Scene2D.cpp

示例7: CORRADE_COMPARE

void DualComplexTransformationTest::rotate() {
    {
        Object2D o;
        o.setTransformation(DualComplex::translation({1.0f, -0.3f}));
        o.rotate(Deg(17.0f));
        CORRADE_COMPARE(o.transformationMatrix(), Matrix3::rotation(Deg(17.0f))*Matrix3::translation({1.0f, -0.3f}));
    } {
        Object2D o;
        o.setTransformation(DualComplex::translation({1.0f, -0.3f}));
        o.rotate(Deg(17.0f), TransformationType::Local);
        CORRADE_COMPARE(o.transformationMatrix(), Matrix3::translation({1.0f, -0.3f})*Matrix3::rotation(Deg(17.0f)));
    }
}
开发者ID:DYSEQTA,项目名称:magnum,代码行数:13,代码来源:DualComplexTransformationTest.cpp

示例8: CORRADE_COMPARE

void RigidMatrixTransformation2DTest::reflect() {
    {
        Object2D o;
        o.setTransformation(Matrix3::rotation(Deg(17.0f)));
        o.reflect(Vector2(-1.0f/Constants::sqrt2()));
        CORRADE_COMPARE(o.transformationMatrix(), Matrix3::reflection(Vector2(-1.0f/Constants::sqrt2()))*Matrix3::rotation(Deg(17.0f)));
    } {
        Object2D o;
        o.setTransformation(Matrix3::rotation(Deg(17.0f)));
        o.reflectLocal(Vector2(-1.0f/Constants::sqrt2()));
        CORRADE_COMPARE(o.transformationMatrix(), Matrix3::rotation(Deg(17.0f))*Matrix3::reflection(Vector2(-1.0f/Constants::sqrt2())));
    }
}
开发者ID:ariosx,项目名称:magnum,代码行数:13,代码来源:RigidMatrixTransformation2DTest.cpp

示例9: setTransformation

void TranslationTransformationTest::setTransformation() {
    Object2D o;

    /* Dirty after setting transformation */
    o.setClean();
    CORRADE_VERIFY(!o.isDirty());
    o.setTransformation({1.0f, -0.3f});
    CORRADE_VERIFY(o.isDirty());
    CORRADE_COMPARE(o.transformationMatrix(), Matrix3::translation({1.0f, -0.3f}));

    /* Scene cannot be transformed */
    Scene2D s;
    s.setClean();
    s.setTransformation({1.0f, -0.3f});
    CORRADE_VERIFY(!s.isDirty());
    CORRADE_COMPARE(s.transformationMatrix(), Matrix3());
}
开发者ID:awoland,项目名称:magnum,代码行数:17,代码来源:TranslationTransformationTest.cpp

示例10: setTransformation

void DualComplexTransformationTest::setTransformation() {
    Object2D o;

    /* Can't transform with non-rigid transformation */
    std::ostringstream out;
    Error::setOutput(&out);
    o.setTransformation(DualComplex({1.0f, 2.0f}, {}));
    CORRADE_COMPARE(out.str(), "SceneGraph::DualComplexTransformation::setTransformation(): the dual complex number is not normalized\n");

    /* Dirty after setting transformation */
    o.setClean();
    CORRADE_VERIFY(!o.isDirty());
    o.setTransformation(DualComplex::rotation(Deg(17.0f)));
    CORRADE_VERIFY(o.isDirty());
    CORRADE_COMPARE(o.transformationMatrix(), Matrix3::rotation(Deg(17.0f)));

    /* Scene cannot be transformed */
    Scene2D s;
    s.setClean();
    s.setTransformation(DualComplex::rotation(Deg(17.0f)));
    CORRADE_VERIFY(!s.isDirty());
    CORRADE_COMPARE(s.transformationMatrix(), Matrix3());
}
开发者ID:DYSEQTA,项目名称:magnum,代码行数:23,代码来源:DualComplexTransformationTest.cpp

示例11: normalizeRotation

void DualComplexTransformationTest::normalizeRotation() {
    Object2D o;
    o.setTransformation(DualComplex::rotation(Deg(17.0f)));
    o.normalizeRotation();
    CORRADE_COMPARE(o.transformationMatrix(), Matrix3::rotation(Deg(17.0f)));
}
开发者ID:DYSEQTA,项目名称:magnum,代码行数:6,代码来源:DualComplexTransformationTest.cpp

示例12: translate

void TranslationTransformationTest::translate() {
    Object2D o;
    o.setTransformation({1.0f, -0.3f})
        .translate({-0.5f, 2.0f});
    CORRADE_COMPARE(o.transformationMatrix(), Matrix3::translation({1.0f, -0.3f})*Matrix3::translation({-0.5f, 2.0f}));
}
开发者ID:awoland,项目名称:magnum,代码行数:6,代码来源:TranslationTransformationTest.cpp

示例13: SetGameIndex

bool PokerGame::PokerGameInit()
{
	ActivateHiloGambleGraphics = 0;

	SetGameIndex(Game100p);

	DisplayStake();
	
	HoldHiloGraphics = false;
	HiloEnteredOnAP = false;

	for (i=0; i<MAX_AWARDS; i++)
	{
		AwardDigitColour[i] = 1;
		AwardValueLitState[i] = 0;
	}

	for (i=0; i<5; i++)
	{
		PokerHand[i].id = 0;
		PokerHand[i].hold = 0;
		HiloHand[i].id = 0;
		HiloHand[i].state = 0;
	}
	
	AwardTable[0][0] = 100;
	AwardTable[0][1] = 200;
	AwardTable[0][2] = 300;
	AwardTable[0][3] = 400;
	AwardTable[0][4] = 600;
	AwardTable[0][5] = 1000;
	AwardTable[0][6] = 2500;
	AwardTable[0][7] = 4000;
	AwardTable[0][8] = 6000;
	AwardTable[0][9] = 10000;
	AwardTable[0][10]= 15000;
	AwardTable[0][11]= 25000;
	AwardTable[0][12]= 50000;

	AwardTable[1][0] = 200;
	AwardTable[1][1] = 400;
	AwardTable[1][2] = 600;
	AwardTable[1][3] = 800;
	AwardTable[1][4] = 1200;
	AwardTable[1][5] = 2000;
	AwardTable[1][6] = 5000;
	AwardTable[1][7] = 8000;
	AwardTable[1][8] = 12000;
	AwardTable[1][9] = 20000;
	AwardTable[1][10]= 30000;
	AwardTable[1][11]= 50000;
	AwardTable[1][12]= 50000;
	
	AwardValuesX = 710;
	AwardValuesY[12] = 41;
	AwardValuesY[11] = 79;
	AwardValuesY[10] = 114;
	AwardValuesY[9]	= 149;
	AwardValuesY[8] = 185;
	AwardValuesY[7] = 222;
	AwardValuesY[6] = 257;
	AwardValuesY[5] = 291;
	AwardValuesY[4] = 329;
	AwardValuesY[3] = 364;
	AwardValuesY[2] = 399;
	AwardValuesY[1] = 434;
	AwardValuesY[0] = 483;

	Object2D* allCards = OBJECT_HANDLER->GetObject2D("Cards");
	allCards->GetInstance(0)->SetCurrentSprite(54);
	allCards->GetInstance(1)->SetCurrentSprite(54);
	allCards->GetInstance(2)->SetCurrentSprite(54);
	allCards->GetInstance(3)->SetCurrentSprite(54);
	allCards->GetInstance(4)->SetCurrentSprite(54);

	InitializeCardButtonArray();
	
	return true;
}
开发者ID:Norcinu,项目名称:1172Dev,代码行数:79,代码来源:PokerGameInit.cpp

示例14: loadProgram

int Game::playTrack(Track& track){
	
	bool raceFinished = false;
	unsigned int timeElapsed = 0;

	//Interface
	Program prog2D;
	prog2D = loadProgram("../shaders/tex2D.vs.glsl", "../shaders/tex2D.fs.glsl");
	prog2D.use();
	
	
	//Carre qui affiche les pouvoirs
	Object2D powerquad;
	powerquad.setVertices(0.7, 0.9, -0.9, -0.64);
	powerquad.build();
	
	//Carre qui affiche la position
	Object2D positionQuad;
	positionQuad.setVertices(-0.9,-0.7,0.64,0.9);
	positionQuad.build();

	//Surfaces pour afficher le classement final (à optimiser)
	Object2D positionQuad1;
	positionQuad1.setVertices(-0.2,-0.1,0.8,0.9);
	positionQuad1.build();
	Object2D positionQuad2;
	positionQuad2.setVertices(-0.2,-0.1,0.6,0.7);
	positionQuad2.build();
	Object2D positionQuad3;
	positionQuad3.setVertices(-0.2,-0.1,0.4,0.5);
	positionQuad3.build();
	Object2D positionQuad4;
	positionQuad4.setVertices(-0.2,-0.1,0.2,0.3);
	positionQuad4.build();
	Object2D positionQuad5;
	positionQuad5.setVertices(-0.2,-0.1,0.0,0.1);
	positionQuad5.build();
	Object2D positionQuad6;
	positionQuad6.setVertices(-0.2,-0.1,-0.2,-0.1);
	positionQuad6.build();
	Object2D positionQuad7;
	positionQuad7.setVertices(-0.2,-0.1,-0.4,-0.3);
	positionQuad7.build();
	Object2D positionQuad8;
	positionQuad8.setVertices(-0.2,-0.1,-0.6,-0.5);
	positionQuad8.build();

	Object2D persoQuad1;
	persoQuad1.setVertices(0.1,0.2,0.8,0.9);
	persoQuad1.build();
	Object2D persoQuad2;
	persoQuad2.setVertices(0.1,0.2,0.6,0.7);
	persoQuad2.build();
	Object2D persoQuad3;
	persoQuad3.setVertices(0.1,0.2,0.4,0.5);
	persoQuad3.build();
	Object2D persoQuad4;
	persoQuad4.setVertices(0.1,0.2,0.2,0.3);
	persoQuad4.build();
	Object2D persoQuad5;
	persoQuad5.setVertices(0.1,0.2,0.0,0.1);
	persoQuad5.build();
	Object2D persoQuad6;
	persoQuad6.setVertices(0.1,0.2,-0.2,-0.1);
	persoQuad6.build();
	Object2D persoQuad7;
	persoQuad7.setVertices(0.1,0.2,-0.4,-0.3);
	persoQuad7.build();
	Object2D persoQuad8;
	persoQuad8.setVertices(0.1,0.2,-0.6,-0.5);
	persoQuad8.build();

	
	GLint locVarTexture;
	locVarTexture= glGetUniformLocation(prog2D.getGLId(), "uTexture");
	GLuint* texturepower=PowerTexture();
	GLuint* textureRank=RankTexture();
	GLuint* texturePerso=PersoTexture();
	
	Program prog;
	prog = loadProgram("../shaders/3D.vs.glsl","../shaders/tex3D.fs.glsl");
	prog.use();
	
	GLuint uMVPMatrix=glGetUniformLocation(prog.getGLId(),"uMVPMatrix");
	GLuint uMVMatrix=glGetUniformLocation(prog.getGLId(),"uMVMatrix");
	GLuint uNormalMatrix=glGetUniformLocation(prog.getGLId(),"uNormalMatrix");
	GLuint uTex=glGetUniformLocation(prog.getGLId(),"uTexture");
	
	GLuint uKd=glGetUniformLocation(prog.getGLId(),"uKd");
	GLuint uKs=glGetUniformLocation(prog.getGLId(),"uKs");
	GLuint uShininess=glGetUniformLocation(prog.getGLId(),"uShininess");
	GLuint uLightDir_vs=glGetUniformLocation(prog.getGLId(),"uLightDir_vs");
	GLuint uLightIntensity=glGetUniformLocation(prog.getGLId(),"uLightIntensity");
	
	glEnable(GL_DEPTH_TEST);
	
	glm::mat4 ViewMatrix;
		
	TrackballCamera camera;
	
//.........这里部分代码省略.........
开发者ID:Bazard,项目名称:HeroKart,代码行数:101,代码来源:Game.cpp


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