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


C++ RectangleShape类代码示例

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


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

示例1: onRender

void UIComponentImage::onRender(GraphicsDevice* renderer, UIView* view)
{
	RectangleShape backgroundRect;
	backgroundRect.setRect(view->getBounds());
	if(mTexture) backgroundRect.setTexture(mTexture);
	renderer->draw(backgroundRect);
}
开发者ID:YurieCo,项目名称:Nephilim,代码行数:7,代码来源:UIComponentImage.cpp

示例2: if

void UIComponentTreeView::onRender(Renderer* renderer, UIView* view)
{
	// Draw a black background on the ROOT tree view
	if(mSubTreeLevel == 0)
	{
		RectangleShape back;
		back.setRect(view->getBounds());
		back.setColor(Color(36,36,36));
		renderer->draw(back);
	}
	/*else if(mSubTreeLevel == 1)
	{
		RectangleShape back;
		back.setRect(view->getBounds());
		back.setColor(Color::Grass);
		renderer->draw(back);
	}
	else if(mSubTreeLevel == 2)
	{
		RectangleShape back;
		back.setRect(view->getBounds());
		back.setColor(Color::Bittersweet);
		renderer->draw(back);
	}
	else if(mSubTreeLevel == 3)
	{
		RectangleShape back;
		back.setRect(view->getBounds());
		back.setColor(Color::Lavender);
		renderer->draw(back);
	}*/
}
开发者ID:faktis,项目名称:Nephilim,代码行数:32,代码来源:UIComponentTreeView.cpp

示例3: draw

void RenderSystem::draw(GameObject* gameObject)
{
	RenderComponent* render = gameObject->getComponent<RenderComponent>();
	if (render != nullptr)
	{
		RectangleShape shape = *render->getDrawable();

		TransformComponent* transform = gameObject->getComponent<TransformComponent>();
		if (transform != nullptr)
		{
			shape.setPosition(transform->getPosition());
		}
		else
		{
			BoardComponent* boardComp = gameObject->getComponent<BoardComponent>();
			if (boardComp != nullptr && mBoard != nullptr)
			{
				Vector2i boardPos = boardComp->getPosition();
				shape.setPosition(mBoard->getTilePosition(boardPos.x, boardPos.y));
			}
		}

		mWindow->draw(shape);
	}
}
开发者ID:tuomoO,项目名称:Ristinolla,代码行数:25,代码来源:RenderSystem.cpp

示例4: isCancelClicked

/*
Determine si le bouton de la boite de dialogue selectionné par le clic
de la souris est celui d'annulation.
*/
bool MainTool::isCancelClicked(int x, int y)
{
	Text ok;
	ok.setFont(font);
	ok.setString("Sauver");
	ok.setCharacterSize(12);
	FloatRect fro = ok.getLocalBounds();

	Text cancel;
	cancel.setFont(font);
	cancel.setString("Annuler");
	cancel.setCharacterSize(12);
	FloatRect frc = cancel.getLocalBounds();

	cancel.setPosition((400 - 40 - fro.width - frc.width) / 2 + 30 + fro.width, 70);

	RectangleShape buttonCancel;
	buttonCancel.setSize(Vector2f(frc.width + 10, frc.height + 10));
	buttonCancel.setPosition(cancel.getPosition().x - 5, cancel.getPosition().y);

	if (buttonCancel.getGlobalBounds().contains(x, y))
		return true;
	else
		return false;
}
开发者ID:npichot,项目名称:Snake,代码行数:29,代码来源:MainTool.cpp

示例5:

void    GameEngine::_initWall(RectangleShape &wall, const unsigned int size,
                              Color const &color, const Vector2f &pos)
{
    wall.setSize(Vector2f(25, size));
    wall.setOrigin(0, size);
    wall.setFillColor(color);
    wall.setPosition(pos);
}
开发者ID:foo-foo,项目名称:F2O,代码行数:8,代码来源:GameEngine.cpp

示例6: onRender

void UIComponentScrollBar::onRender(Renderer* renderer, UIView* view)
{
	RectangleShape scrollBarBackground;
	scrollBarBackground.setSize(17.f, view->getSize().y);
	scrollBarBackground.setPosition(view->getPosition().x + view->getSize().y - 17.f, view->getPosition().y);
	scrollBarBackground.setColor(Color::Blue);
	renderer->draw(scrollBarBackground);

	renderer->draw(scrollBarPaddle);
}
开发者ID:faktis,项目名称:Nephilim,代码行数:10,代码来源:UIComponentScrollBar.cpp

示例7: Check

//Точка входит в квадрат?
bool Check(RectangleShape rect, CircleShape shape){
	Vector2f coordrect = rect.getPosition();
	Vector2f coordshape = shape.getPosition();

	if (coordrect.x <= coordshape.x &&
		coordrect.y <= coordshape.y &&
		coordrect.x + rect.getSize().x >= coordshape.x &&
		coordrect.y + rect.getSize().y >= coordshape.y)
	{
		return true;
	}
	else { return false; }
}
开发者ID:FirKys,项目名称:session_2,代码行数:14,代码来源:main2.cpp

示例8: RectangleShape

KShape *RectangleShapeFactory::createDefaultShape(KResourceManager *) const
{
    RectangleShape *rect = new RectangleShape();

    rect->setBorder(new KLineBorder(1.0));
    rect->setShapeId(KoPathShapeId);

    QLinearGradient *gradient = new QLinearGradient(QPointF(0,0), QPointF(1,1));
    gradient->setCoordinateMode(QGradient::ObjectBoundingMode);

    gradient->setColorAt(0.0, Qt::white);
    gradient->setColorAt(1.0, Qt::green);
    rect->setBackground(new KGradientBackground(gradient));

    return rect;
}
开发者ID:KDE,项目名称:koffice,代码行数:16,代码来源:RectangleShapeFactory.cpp

示例9: afficher

void Snake::afficher(sf::RenderWindow * _window){
    int colorByQuad = 200/corps.size();
    for(int i=0;i<corps.size();i++){
        partCorps.setFillColor(Color(10,255-(i*colorByQuad),10));
        partCorps.setPosition(Vector2f(corps[i].x*partSize,corps[i].y*partSize));
        _window->draw(partCorps);
    }
    _window->draw(partFood);
    if(loose){
            RectangleShape tmp;
    tmp.setFillColor(Color(50,0,0,127));
    tmp.setPosition(0,0);
    tmp.setSize(Vector2f(largeur,hauteur));
        _window->draw(tmp);
        _window->draw(text);
        _window->draw(text2);
    }
}
开发者ID:Babanar,项目名称:Snake,代码行数:18,代码来源:snake.cpp

示例10: step_five

void step_five(RectangleShape &rectangle, float time, int number_block, float &x, float &y, int &step, float &size_y)
{
	if (x > RECTANGLES_SIZE.x / 2)
		x -= time * 0.1;
	else {
		step = MOVE_DOWN;
		rectangle.setFillColor(Color::Blue);
	}
}
开发者ID:KatherineTsareg,项目名称:Programming-Theory,代码行数:9,代码来源:Main.cpp

示例11: step_one

void step_one(RectangleShape &rectangle, float time, float &y, int &step)
{
	if (y > WINDOW_SIZE.y - RECTANGLES_SIZE.y / 2) {
		rectangle.setFillColor(Color::Magenta);
		step = MOVE_RIGHT_AND_UP;
	}
	else
		y += time * 0.1;
}
开发者ID:KatherineTsareg,项目名称:Programming-Theory,代码行数:9,代码来源:Main.cpp

示例12: resetBall

	void resetBall() {
		FloatRect p = player.getGlobalBounds();
		FloatRect b = ball.getGlobalBounds();
		ball.setPosition(p.left + p.width/2 + 5, p.top);
		ballSpeed.x = 0.1f;
		ballSpeed.y = -0.3f;
	}
开发者ID:ndt93,项目名称:Break-Out,代码行数:7,代码来源:main.cpp

示例13:

	Wire(float mX, float mY)
	{
		line.setSize(Vector2f(5, 5));
		line.setPosition(mX, mY);
		line.setFillColor(Color::Red);
				
	}
开发者ID:jbhoopesphd,项目名称:circuit_game,代码行数:7,代码来源:game.cpp

示例14:

	// The constructor is almost identical to the `Paddle` one.
	Brick(float mX, float mY) 
	{ 
		shape.setPosition(mX, mY);
		shape.setSize({blockWidth, blockHeight});
		shape.setFillColor(Color::Yellow);
		shape.setOrigin(blockWidth / 2.f, blockHeight / 2.f);
	}
开发者ID:ardraeiss,项目名称:Tutorials,代码行数:8,代码来源:p7.cpp

示例15: updatePlayer

	void updatePlayer() {
		if (Keyboard::isKeyPressed(Keyboard::Left)) {
			player.move(-moveDistance * updateTime/50.0, 0);
		} else if (Keyboard::isKeyPressed(Keyboard::Right)) {
			player.move(moveDistance * updateTime/50.0, 0);
		}
	}
开发者ID:ndt93,项目名称:Break-Out,代码行数:7,代码来源:main.cpp


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