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


C++ Vect2函数代码示例

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


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

示例1: DrawBitmap

    void DrawBitmap(UINT texID, float alpha, const Vect2 &startPos, const Vect2 &startSize)
    {
        DWORD curAlpha = DWORD(alpha*255.0f);

        Vect2 pos = Vect2(0.0f, 0.0f);
        Vect2 size = fullSize;

        Vect2 itemSize = Vect2((float)textures[texID]->Width(), (float)textures[texID]->Height());

        double sourceAspect = double(itemSize.x)/double(itemSize.y);
        if(!CloseDouble(baseAspect, sourceAspect))
        {
            if(baseAspect < sourceAspect)
                size.y = float(double(size.x) / sourceAspect);
            else
                size.x = float(double(size.y) * sourceAspect);

            pos = (fullSize-size)*0.5f;

            pos.x = (float)round(pos.x);
            pos.y = (float)round(pos.y);

            size.x = (float)round(size.x);
            size.y = (float)round(size.y);
        }

        pos /= fullSize;
        pos *= startSize;
        pos += startPos;
        Vect2 lr;
        lr = pos + (size/fullSize*startSize);

        DrawSprite(textures[texID], (curAlpha<<24) | 0xFFFFFF, pos.x, pos.y, lr.x, lr.y);
    }
开发者ID:magicpriest,项目名称:OBS,代码行数:34,代码来源:BitmapTransitionSource.cpp

示例2: Vect2

void SceneItem::Update()
{
    pos = Vect2(element->GetFloat(TEXT("x")), element->GetFloat(TEXT("y")));
    size = Vect2(element->GetFloat(TEXT("cx"), 100.0f), element->GetFloat(TEXT("cy"), 100.0f));

    //just reset the size if configuration changed, that way the user doesn't have to screw with the size
    //if(source) size = source->GetSize();
    /*element->SetInt(TEXT("cx"), int(size.x));
    element->SetInt(TEXT("cy"), int(size.y));*/
}
开发者ID:373137461,项目名称:OBS,代码行数:10,代码来源:Scene.cpp

示例3: AppWarning

SceneItem* Scene::InsertImageSource(UINT pos, XElement *sourceElement)
{
    if(GetSceneItem(sourceElement->GetName()) != NULL)
    {
        AppWarning(TEXT("Scene source '%s' already in scene.  actually, no one should get this error.  if you do send it to jim immidiately."), sourceElement->GetName());
        return NULL;
    }

    if(pos > sceneItems.Num())
    {
        AppWarning(TEXT("Scene::InsertImageSource: pos >= sceneItems.Num()"));
        pos = sceneItems.Num();
    }

    CTSTR lpClass = sourceElement->GetString(TEXT("class"));
    ImageSource *source = NULL;

    if(!lpClass)
        AppWarning(TEXT("No class for source '%s' in scene '%s'"), sourceElement->GetName(), API->GetSceneElement()->GetName());
    else
    {
        source = API->CreateImageSource(lpClass, sourceElement->GetElement(TEXT("data")));
        if(!source)
            AppWarning(TEXT("Could not create image source '%s' in scene '%s'"), sourceElement->GetName(), API->GetSceneElement()->GetName());
    }

    float x  = sourceElement->GetFloat(TEXT("x"));
    float y  = sourceElement->GetFloat(TEXT("y"));
    float cx = sourceElement->GetFloat(TEXT("cx"), 100);
    float cy = sourceElement->GetFloat(TEXT("cy"), 100);
    bool render = sourceElement->GetInt(TEXT("render"), 1) > 0;

    SceneItem *item = new SceneItem;
    item->element = sourceElement;
    item->parent = this;
    item->source = source;
    item->pos = Vect2(x, y);
    item->size = Vect2(cx, cy);
    item->crop.w = sourceElement->GetFloat(TEXT("crop.top"));
    item->crop.x = sourceElement->GetFloat(TEXT("crop.left"));
    item->crop.y = sourceElement->GetFloat(TEXT("crop.bottom"));
    item->crop.z = sourceElement->GetFloat(TEXT("crop.right"));
    item->SetRender(render);

    API->EnterSceneMutex();
    if(bSceneStarted) source->BeginScene();
    sceneItems.Insert(pos, item);
    API->LeaveSceneMutex();

    if(!source)
        bMissingSources = true;

    return item;
}
开发者ID:Soopah,项目名称:OBS,代码行数:54,代码来源:Scene.cpp

示例4: sq

Vect2 TangentLine::Q(const Vect2& s, const double D, const int eps) {
  double sq_s = s.sqv();
  double sq_D = sq(D);
  double delta = sq_s -sq_D;
  if (delta >= 0) { 
    double alpha = sq_D/sq_s;
    double beta  = D*sqrt_safe(delta)/sq_s;
    return Vect2(alpha*s.x+eps*beta*s.y,
		 alpha*s.y-eps*beta*s.x);   
    }
    return Vect2();
}
开发者ID:E-LLP,项目名称:WellClear,代码行数:12,代码来源:TangentLine.cpp

示例5: Vect2

void Scene::RenderSelections()
{
    for(UINT i=0; i<sceneItems.Num(); i++)
    {
        SceneItem *item = sceneItems[i];
        if(item->bSelected)
        {
            Vect2 pos  = API->MapFrameToWindowPos(item->GetPos())+1.0f;
            Vect2 size = API->MapFrameToWindowSize(item->GetSize())-2.0f;
            Vect2 selectBoxSize = Vect2(10.0f, 10.0f);

            DrawBox(pos, selectBoxSize);
            DrawBox((pos+size)-selectBoxSize, selectBoxSize);
            DrawBox(pos+Vect2(size.x-selectBoxSize.x, 0.0f), selectBoxSize);
            DrawBox(pos+Vect2(0.0f, size.y-selectBoxSize.y), selectBoxSize);
            DrawBox(pos, size);
        }
    }
}
开发者ID:Soopah,项目名称:OBS,代码行数:19,代码来源:Scene.cpp

示例6: updateBullets

void Game::updateMap()
{
    updateBullets();
    updateMinions();

    QuadTree q(Vect2(0, 0), Vect2(800, 600), _gameTime);
    q.createInfluenceTree(_ennemies);

    for (std::list<Player *>::iterator it = _playerList.begin(); it != _playerList.end(); ++it) {
        if ((*it)->isAlive()) {
            q.insert(*it);
        }
    }
    for (std::list<Entity *>::iterator it = _missiles.begin(); it != _missiles.end(); ++it) {
        if ((*it)->isAlive()) {
            q.insert(*it);
        }
    }
}
开发者ID:zheck,项目名称:rtype,代码行数:19,代码来源:Game.cpp

示例7: AppWarning

SceneItem* Scene::InsertImageSource(UINT pos, XElement *sourceElement)
{
    if(GetSceneItem(sourceElement->GetName()) != NULL)
    {
        AppWarning(TEXT("Scene source '%s' already in scene.  actually, no one should get this error.  if you do send it to jim immidiately."), sourceElement->GetName());
        return NULL;
    }

    if(pos > sceneItems.Num())
    {
        AppWarning(TEXT("Scene::InsertImageSource: pos >= sceneItems.Num()"));
        pos = sceneItems.Num();
    }

    bool render = sourceElement->GetInt(TEXT("render"), 1) > 0;

    float x  = sourceElement->GetFloat(TEXT("x"));
    float y  = sourceElement->GetFloat(TEXT("y"));
    float cx = sourceElement->GetFloat(TEXT("cx"), 100);
    float cy = sourceElement->GetFloat(TEXT("cy"), 100);

    SceneItem *item = new SceneItem;
    item->element = sourceElement;
    item->parent = this;
    item->pos = Vect2(x, y);
    item->size = Vect2(cx, cy);
    item->crop.w = sourceElement->GetFloat(TEXT("crop.right"));
    item->crop.x = sourceElement->GetFloat(TEXT("crop.left"));
    item->crop.y = sourceElement->GetFloat(TEXT("crop.top"));
    item->crop.z = sourceElement->GetFloat(TEXT("crop.bottom"));
    item->SetRender(render);

    API->EnterSceneMutex();
    sceneItems.Insert(pos, item);
    API->LeaveSceneMutex();

    /*if(!source)
        bMissingSources = true;*/

    return item;
}
开发者ID:373137461,项目名称:OBS,代码行数:41,代码来源:Scene.cpp

示例8: Vect2

void Scene::RenderSelections(Shader *solidPixelShader)
{
    for(UINT i=0; i<sceneItems.Num(); i++)
    {
        SceneItem *item = sceneItems[i];

        if(item->bSelected)
        {
            Vect2 pos  = API->MapFrameToWindowPos(item->GetPos())+1.0f;
            Vect2 scale = API->GetFrameToWindowScale();
            pos.x += item->GetCrop().w * scale.x;
            pos.y += item->GetCrop().x * scale.y;
            Vect2 size = API->MapFrameToWindowSize(item->GetSize())-2.0f;
            size.x -= (item->GetCrop().y + item->GetCrop().w) * scale.x;
            size.y -= (item->GetCrop().x + item->GetCrop().z) * scale.y;
            
            Vect2 selectBoxSize = Vect2(10.0f, 10.0f);
            
            DrawBox(pos, selectBoxSize);
            DrawBox((pos+size)-selectBoxSize, selectBoxSize);
            DrawBox(pos+Vect2(size.x-selectBoxSize.x, 0.0f), selectBoxSize);
            DrawBox(pos+Vect2(0.0f, size.y-selectBoxSize.y), selectBoxSize);
            

            // Top
            if (CloseFloat(item->crop.x, 0.0f)) solidPixelShader->SetColor(solidPixelShader->GetParameter(0), 0xFF0000);
            else solidPixelShader->SetColor(solidPixelShader->GetParameter(0), 0x00FF00);
            DrawBox(pos, Vect2(size.x, 0.0f));

            // Left
            if (CloseFloat(item->crop.w, 0.0f)) solidPixelShader->SetColor(solidPixelShader->GetParameter(0), 0xFF0000);
            else solidPixelShader->SetColor(solidPixelShader->GetParameter(0), 0x00FF00);
            DrawBox(pos, Vect2(0.0f, size.y));

            // Right
            if (CloseFloat(item->crop.y, 0.0f)) solidPixelShader->SetColor(solidPixelShader->GetParameter(0), 0xFF0000);
            else solidPixelShader->SetColor(solidPixelShader->GetParameter(0), 0x00FF00);
            DrawBox(pos+Vect2(size.x, 0.0f), Vect2(0.0f, size.y));

            // Bottom
            if (CloseFloat(item->crop.z, 0.0f)) solidPixelShader->SetColor(solidPixelShader->GetParameter(0), 0xFF0000);
            else solidPixelShader->SetColor(solidPixelShader->GetParameter(0), 0x00FF00);
            DrawBox(pos+Vect2(0.0f, size.y), Vect2(size.x, 0.0f));
        }
    }
}
开发者ID:jmkstewart,项目名称:OBS,代码行数:46,代码来源:Scene.cpp

示例9: Vect2

void ProcessDateTime::Render(const Vect2 &pos, const Vect2 &size, Texture *FilterTexture, bool bScaleFull, bool bIsLiveC)
{
	bScaleFull = false;
	if (texture)
	{
		//EnableBlending(FALSE);
		Vect2 sizeMultiplier = size / Resolution;

		sizeMultiplier.x += 0.1;
		Vect2 newSize = Vect2(float(textureSize.cx), float(textureSize.cy)) * sizeMultiplier;

		DWORD alpha = DWORD(double(globalOpacity)*2.55);
		DWORD outputColor = (alpha << 24) | 0xFFFFFF;

		DrawSprite(texture, outputColor, pos.x, pos.y, pos.x + newSize.x, pos.y + newSize.y);

		//EnableBlending(TRUE);
	}
}
开发者ID:wwllww,项目名称:LiveStream_MultiIntance,代码行数:19,代码来源:libDateTime.cpp

示例10: while

void TextComponent_BullShit::Render()
{
	int charIndex = 0;
	TextObject* textObj;
	SpriteComponent * textSprite;
	while (text[charIndex] != '\0')
	{
		textObj = OpenGLRenderer::GetRenderer()->GetCharacterImage(text[charIndex]);
		
		textSprite = textObj->GetTextSprite();

		textSprite->SetHidden(false);
		textSprite->SetPosition(GetPosition() + Vect2(charIndex * CHAR_WIDTH, 0));
		textSprite->Render();
		textSprite->SetHidden(true);
	
		++charIndex;
	}
}
开发者ID:jahandideh-iman,项目名称:OpenGLES_ProjectCars,代码行数:19,代码来源:TextComponent_BullShit.cpp

示例11: Scene

	GameScene::GameScene(Vect2 avatarPosition) : Scene(avatarPosition), m_startedCountdown(false), m_transitioning(false)
	{
		b2FixtureDef fixDef;
		fixDef.density = 1.0f;
		fixDef.friction = 0.3f;
		
		// make left wall
		b2BodyDef leftWallBody;
		leftWallBody.position.Set(-30.0f,0.0);
		
		b2PolygonShape wallShape;
		wallShape.SetAsBox(.5f, 26.0f);
		mp_physicsWorld->CreateBody(&leftWallBody)->CreateFixture(&wallShape, 0.0f);
		
		b2PolygonShape ceilingShape;
		ceilingShape.SetAsBox(50.0f, .5f);
		
		// make right Wall
		b2BodyDef rightWallBody;
		rightWallBody.position.Set(50.0f,0.0);
		mp_physicsWorld->CreateBody(&rightWallBody)->CreateFixture(&wallShape, 0.0f);	
		
		b2BodyDef ceilingBody;
		ceilingBody.position.Set(0.0f, -20.0f);
		mp_physicsWorld->CreateBody(&ceilingBody)->CreateFixture(&ceilingShape, 0.0f);
		
		mp_windmillPuzzle = new WindmillPuzzle(mp_physicsWorld);
		
		PhysicsSprite* junk[6];
		junk[0] = new PhysicsSprite("Junk:bigpipe", *mp_physicsWorld, Vect2(-8, 15));
		junk[1] = new PhysicsSprite("Junk:junkrect", *mp_physicsWorld, Vect2(1, 15));
		junk[2] = new PhysicsSprite("Junk:bigpipe", *mp_physicsWorld, Vect2(10, 15));
		junk[3] = new PhysicsSprite("Junk:smallpipe", *mp_physicsWorld, Vect2(15, 15));
		junk[4] = new PhysicsSprite("Junk:bigpipe", *mp_physicsWorld, Vect2(20, 15));
		junk[5] = new PhysicsSprite("Junk:junkrect", *mp_physicsWorld, Vect2(25, 15));
		
		//Sprite * blueprintSprite = new Sprite("test:cow");
		//blueprintSprite->position.x = 16.0;
		//blueprintSprite->position.y = 12.0;
		
		for (int i = 0; i < 6; ++i) 
		{
			mr_camera->AddChild(*junk[i]);
		}
		
		mr_camera->AddChild(*mp_windmillPuzzle);
		//camera->AddChild(*blueprintSprite);
	}
开发者ID:jweinberg,项目名称:deadbeef,代码行数:48,代码来源:GameScene.cpp

示例12: GetRenderFrameControlSize

 virtual Vect2 GetRenderFrameControlSize() const {return Vect2(float(App->renderFrameCtrlWidth), float(App->renderFrameCtrlHeight));}
开发者ID:ChaosPower,项目名称:OBS,代码行数:1,代码来源:API.cpp

示例13: GetRenderFrameOffset

 virtual Vect2 GetRenderFrameOffset() const      {return Vect2(float(App->renderFrameX), float(App->renderFrameY));}
开发者ID:ChaosPower,项目名称:OBS,代码行数:1,代码来源:API.cpp

示例14: GetRenderFrameSize

 virtual Vect2 GetRenderFrameSize() const        {return Vect2(float(App->renderFrameWidth), float(App->renderFrameHeight));}
开发者ID:ChaosPower,项目名称:OBS,代码行数:1,代码来源:API.cpp

示例15: GetBaseSize

 virtual Vect2 GetBaseSize() const               {return Vect2(float(App->baseCX), float(App->baseCY));}
开发者ID:ChaosPower,项目名称:OBS,代码行数:1,代码来源:API.cpp


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