You can try and change the m_direction and m_position lines in the following code:
m_player = new Player();
m_player->m_direction(-1, 0, 0, 0);
m_player->m_position(0, 10.0f, 1, 0);
as this:
m_player->m_direction = DirectX::SimpleMath::Vector3(-1.0f, 0.0f, 0.0f, 0.0f);
m_player->m_position = DirectX::SimpleMath::Vector3(0.0f, 10.0f, 1.0f, 0.0f);
Basically you should invoke the constructor for DirectX::SimpleMath::Vector3
to build the vector objects you want to assign.
Here I am assuming that you can access the m_direction
and m_position
fields, for example that is possible if they are public
fields.
As an alternative, if you have defined a proper Player
constructor that takes these vectors as input parameters, you can simply do something like:
m_player = new Player( DirectX::SimpleMath::Vector3(...),
DirectX::SimpleMath::Vector3(...) );
Note also that in C++ it's idiomatic to create objects on the stack instead of dynamically allocate them on the heap using new
. In other words: C++ is not Java.
I don't know the rest of your code, but please make sure that you have a good reason to use new
in the above case (and pay attention to properly delete
the Player
object you allocated with new
). If you do need some form of dynamic allocation, a proper smart pointer like std::unique_ptr
and its std::make_unique
helper can come in handy.