Im trying to write a class for each type of sprite (Bullets, enemy sprites etc) and one member of them all I want to be is their current position
so I try having the following in each class:
D3DXVECTOR3 pos(0,0,0)
but visual studio underlines all 3 0s in red, saying I need a type specifier, like it thinks Im doing a function declaration or something.
Yes, I have all needed includes.
The main code file has similiar declarations and gives no errors, yet the individual cpp files for the classes give this error. I dont get what the problem is.
Direct X visual studio issue
If that declaration is in the header for your base class, then you're trying to initialize pos in the class definition (which would require a call to the D3DXVECTOR3 constructor).
Alternatively, in the class constructor add something like:
Alternatively, in the class constructor add something like:
// definition
class MyClass
{
MyClass(void);
D3DXVECTOR3 pos;
//.. other stuff
};
// constructor
MyClass::MyClass(void): pos(D3DXVECTOR3(0,0,0))
{
// ... other initialization
}
//=== OR ===
MyClass::MyClass(void)
{
pos = D3DXVECTOR3(0,0,0);
//... other initilization
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement