コード例 #1
0
ファイル: PartEmitter.cpp プロジェクト: somaen/Wintermute-git
HRESULT CPartEmitter::AddForce(char *Name, CPartForce::TForceType Type, int PosX, int PosY, float Angle, float Strength) {
	CPartForce *Force = AddForceByName(Name);
	if (!Force) return E_FAIL;

	Force->m_Type = Type;
	Force->m_Pos = Vector2(PosX, PosY);

	Force->m_Direction = Vector2(0, Strength);
	Matrix4 MatRot;
	MatRot.RotationZ(DegToRad(CBUtils::NormalizeAngle(Angle - 180)));
	MatRot.TransformVector2(Force->m_Direction);

	return S_OK;
}
コード例 #2
0
HRESULT CPartEmitter::AddForce(char* Name, CPartForce::TForceType Type, int PosX, int PosY, float Angle, float Strength)
{
	CPartForce* Force = AddForceByName(Name);
	if(!Force) return E_FAIL;

	Force->m_Type = Type;
	Force->m_Pos = D3DXVECTOR2(PosX, PosY);

	Force->m_Direction = D3DXVECTOR2(0, Strength);
	D3DXMATRIX MatRot;
	D3DXMatrixRotationZ(&MatRot, DegToRad(CBUtils::NormalizeAngle(Angle - 180)));
	D3DXVec2TransformCoord(&Force->m_Direction, &Force->m_Direction, &MatRot);

	return S_OK;
}