コード例 #1
0
ファイル: Circle.cpp プロジェクト: jbromley/ColorBoxes
Circle::Circle(float x, float y, ColorBoxesEngine* engine)
    : PhysicsEntity(0, engine),
      radius_(randomFloat(2.0f, 16.0f))
{
    borderColor_ = GLColor::randomRGBColor();
    fillColor_ = borderColor_.lighten(0.5f);
    makeBody(b2Vec2(x, y));
}
コード例 #2
0
ファイル: protocol.c プロジェクト: longqzh/EMS-AMI
int makeSendMsg(UINT8 *body, UINT32 encryptLen,UINT16 cmdType, UINT8 *sendbuf)
{
	UINT16 crc;

	makeHeader(cmdType, encryptLen, sendbuf);
	makeBody(body, encryptLen, sendbuf);
	crc=getCRC16(sendbuf, 10+encryptLen);
	makeTail(crc, encryptLen, sendbuf);

	return 0;
}
コード例 #3
0
ファイル: pentity.cpp プロジェクト: LeviSchuck/physics-tests
	void Entity::init(const ShapeList & list, const MassProperties mass, const Transform t){
		std::vector< ::std::pair<size_t, Transform> > shapes;
		size_t compound;
		//Create the shapes
		for_each(list.begin(), list.end(), [&](const ShapeList::value_type & shape){
			switch(shape.first.type){
				case E_CAPSULE:
				case E_SPHERE:
				case E_BOX:
				case E_PLANE:
				{
					size_t s = createShape(
						shape.first.type,
						Math::Vec4ToVec3(shape.first.data),
						Math::VecLast(shape.first.data)
					);
					Transform t = shape.second;
					::std::pair<size_t, Transform> p(s,t);
					shapes.push_back(p);
				}
				break;
				case E_MESH:
				{
					size_t s = createShape(
						shape.first.type,
						shape.first.rawMesh
					);
					Transform t = shape.second;
					::std::pair<size_t, Transform> p(s,t);
					shapes.push_back(p);
				}
				break;
				default:
				{
					throw "Not valid shape type!";
				}
			}
		});
		//Got a list of shapes, make the compound shape
		compound = _world->compoundShapes(shapes);
		//Put it back on with the compound object first
		_shape_index.push_back(compound);
		for_each(shapes.begin(),shapes.end(),[&](decltype(shapes)::value_type s){
			_shape_index.push_back(s.first);
		});
		//create body
		makeBody(t, mass);
	}
コード例 #4
0
ファイル: pentity.cpp プロジェクト: LeviSchuck/physics-tests
	void Entity::init(const Vec3 data, const MassProperties mass, const Transform t, const float constant){
		size_t shape = createShape(_type, data, constant);
		_shape_index.push_back(shape);
		//create body
		makeBody(t, mass);
	}
コード例 #5
0
ファイル: pentity.cpp プロジェクト: LeviSchuck/physics-tests
	void Entity::init(const Mesh & m, const MassProperties mass, const Transform t){
		size_t shape = createShape(_type, m);
		_shape_index.push_back(shape);
		//create body
		makeBody(t, mass);
	}