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


C++ CircleShape::setOrigin方法代码示例

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


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

示例1: TestBox

    TestBox(bool isCollidable) :
        sg::Entity(isCollidable)
    {

        r0.setSize(sf::Vector2f(100.0f, 50.0f));
        r0.setOrigin(50.0f, 25.0f);
        this->addDrawable(r0, false);
        bs.addShape(r0);
        r1.setRadius(40.0f);
        r1.setOrigin(40.0f, 40.0f);
        r1.move(100.0f, 0.0f);
        r1.scale(2.0f, 1.0f);
        this->addDrawable(r1, false);
        bs.addShape(r1);
        r2.setSize(sf::Vector2f(250.0f, 10.0f));
        r2.setOrigin(125.0f, 5.0f);
        r2.rotate(-90.0f);
        this->addDrawable(r2, false);
        bs.addShape(r2);
        r3.setRadius(40.0f);
        r3.setOrigin(40.0f, 40.0f);
        r3.move(-100.0f, 0.0f);
        this->addDrawable(r3, false);
        bs.addShape(r3);
        //bs.rotate(-45.0f);
        this->addTransformable(bs);
        //this->rotate(45.0f);

    }
开发者ID:klinginE,项目名称:Shogun-GameEngine,代码行数:29,代码来源:TestBox.hpp

示例2: Ball

 Ball(float mX, float mY)
 {
     shape.setPosition(mX, mY);
     shape.setRadius(defRadius);
     shape.setFillColor(defColor);
     shape.setOrigin(defRadius, defRadius);
 }
开发者ID:Boza-s6,项目名称:cppcon2014,代码行数:7,代码来源:p04.cpp

示例3:

Stone (float x, float y, float a, float b)
{
    velocity.x = x;
    velocity.y = y;
    s.setRadius(radius);
    s.setOrigin(radius,radius);
    s.setFillColor(sf::Color::Black);
    s.setPosition(a,b);

}
开发者ID:nsalv,项目名称:VariousProjects,代码行数:10,代码来源:stone.hpp

示例4: createGeometry

		void createGeometry() {
			fill = type == Type::Follower ? sf::Color(198, 156, 109, 255) : sf::Color(0, 191, 243, 255);
			outline = type == Type::Follower ?  sf::Color(166, 124, 82, 255) : sf::Color(64, 140, 203, 255);

			geometry.setRadius(radius);
			geometry.setPointCount(6);
			geometry.setFillColor(fill);
			geometry.setOutlineColor(outline);
			geometry.setOutlineThickness(2);
			geometry.setOrigin(radius, radius);
		}
开发者ID:Windsdon,项目名称:zombie,代码行数:11,代码来源:main.cpp

示例5: set_circle

void set_circle(sf::CircleShape& circle, const float value, const float norm_radius,
				const sf::Vector2f& position, const sf::Color& color)
{
	
	const float radius{sqrt_value_tot_radius(value, norm_radius)};
	
	circle.setRadius(radius);
	circle.setOrigin(radius, radius);
	circle.setPosition(position);
	circle.setFillColor(color);
	
}
开发者ID:janderkkotlarski,项目名称:GUI,代码行数:12,代码来源:Top_Down_V0-2.cpp

示例6: Ball

    // Costruttore: prende come parametri la posizione iniziale
    // della pallina, sotto forma di due `float`.
    Ball(float mX, float mY)
    {
        // SFML usa un sistema di coordinate avente l'origine
        // posizionata nell'angolo in alto a sinistra della
        // finestra.
        // {Info: coordinate system}

        shape.setPosition(mX, mY);
        shape.setRadius(defRadius);
        shape.setFillColor(defColor);
        shape.setOrigin(defRadius, defRadius);
    }
开发者ID:SuperV1234,项目名称:itcpp2015,代码行数:14,代码来源:p02.cpp

示例7: cerclesTransparents

    cerclesTransparents():
        _mesCercles(),
        __vectCercles()
    {
        sf::Vector2u tailleWindow = _window.getSize();
        unsigned int hauteur = tailleWindow.y;
        unsigned int largeur = tailleWindow.x;
        float rayon = 400;

        for(int i = 0 ; i < 10; i++)
        {
            _mesCercles.setOrigin(rayon, rayon);
            _mesCercles.setPosition(400,400);
            _mesCercles.setRadius(rayon);
            _mesCercles.setFillColor(sf::Color(0.0, 0.0 + (25*i) , 255 - (25*i), 127));
            rayon -= 25;
            __vectCercles.push_back(_mesCercles);
        }

        cout << "Taille du vect --> " <<  __vectCercles.size() << endl;
    }
开发者ID:xeloni,项目名称:ProjetsClion,代码行数:21,代码来源:cerclesTransparents.hpp

示例8:

	Ball(float mX, float mY) {
		shape.setPosition(mX, mY);
		shape.setRadius(ballRadius);
		shape.setFillColor(sf::Color::Red);
		shape.setOrigin(ballRadius, ballRadius);
	}
开发者ID:CodeBlockers,项目名称:ZombieWasteland,代码行数:6,代码来源:modelo_main.cpp

示例9: centerOrigin

void Utilities::centerOrigin( sf::CircleShape& circle )
{
  sf::FloatRect bounds = circle.getLocalBounds();
  circle.setOrigin( std::floor( bounds.left + bounds.width / 2.0f ), std::floor( bounds.top + bounds.height / 2.0f ) );
}
开发者ID:Glimster,项目名称:Solar-system-shooter,代码行数:5,代码来源:Utilities.cpp

示例10: if

int		main()
{
	sf::Clock			clock;
	double				s = 0;
	
	double				viewZoom = 1.0f;

	srand(time(0));

	for (u32 i = 0; i < PN; i++)
	{
		particule[i]._px = rand() % WINX;
		particule[i]._py = rand() % WINY;
		if (INITIAL_SPEED_ACTIVATE)
		{
			particule[i]._mx = ((rand() % INITIAL_SPEED) - INITIAL_SPEED / 2) / INITIAL_SPEED_DIV;
			particule[i]._my = ((rand() % INITIAL_SPEED) - INITIAL_SPEED / 2) / INITIAL_SPEED_DIV;
		}
		else
		{
			particule[i]._mx = 0;
			particule[i]._my = 0;
		}
		particule[i]._mass = PAR_MASS;
		particule[i]._color = PCOLOR;
	}

	planet.setPosition(sf::Vector2f(WINX/2, WINY/2));
	planet.setOrigin(sf::Vector2f(10.0f, 10.0f));
	planet.setFillColor(sf::Color::Blue);

	win.create(sf::VideoMode(WINX, WINY), "ORBITE");
	win.setFramerateLimit(MAXFPS);
	clock.restart();
	while (win.isOpen())
	{
		s = clock.restart().asSeconds();
		s *= SPEED;

		sf::View view = win.getDefaultView();
		view.zoom(viewZoom);

		while (win.pollEvent(eve))
		{
			if (eve.type == sf::Event::Closed)
				win.close();
			if (eve.type == sf::Event::KeyPressed)
			{
				if (eve.key.code == sf::Keyboard::Add)
					viewZoom -= 0.25f;
				else if (eve.key.code == sf::Keyboard::Subtract)
					viewZoom += 0.25f;
				else if (eve.key.code == sf::Keyboard::Space)
				{
					trace.clear();
					for (u32 i = 0; i < PN; i++)
					{
						particule[i]._px = rand() % WINX;
						particule[i]._py = rand() % WINY;
						if (INITIAL_SPEED_ACTIVATE)
						{
							particule[i]._mx = ((rand() % INITIAL_SPEED) - INITIAL_SPEED / 2) / INITIAL_SPEED_DIV;
							particule[i]._my = ((rand() % INITIAL_SPEED) - INITIAL_SPEED / 2) / INITIAL_SPEED_DIV;
						}
						else
						{
							particule[i]._mx = 0;
							particule[i]._my = 0;
						}
						particule[i]._mass = PAR_MASS;
						particule[i]._color = PCOLOR;
					}		
				}
			}
		}
		
		planet.setPosition((sf::Vector2f)sf::Mouse::getPosition(win));
		for (u32 i = 0; i < PN; i++)
		{
			particule[i].updateToPosition(planet.getPosition(), PL_MASS, s);
			part[i].position = sf::Vector2f(particule[i]._px, particule[i]._py);
			part[i].color = particule[i]._color;
			if (ACTIVATE_ORBIT_TRACE)
			{
				sf::Vertex cpy = part[i];
				trace.append(cpy);
			}
		}
		win.setView(view);
		win.clear(sf::Color::Black);
		win.draw(planet);
		win.draw(part);
		win.draw(trace);
		win.display();
	}
	return (0);
}
开发者ID:Draguld,项目名称:orbite,代码行数:97,代码来源:main.cpp

示例11: setRadius

// Circle Shape 
void Unit::setRadius(float radius) {
	_circle.setRadius(radius);
	_circle.setOrigin(_circle.getRadius(), _circle.getRadius());
}
开发者ID:ttang1,项目名称:BitGame,代码行数:5,代码来源:Unit.hpp


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