lundi 16 mars 2015

Declaring a variable of a variable?


I'm working on using input from the mouse to move a sprite in DirectX.


I'm trying to use this example from the professor, But you see my commented error:



// Mouse
float mouseSensitivity = 2000.0f;
spriteObj[5].position.x += (mouseState.lX * mouseSensitivity) * dt;//Error 1 error C2228: left of '.position' must have class/struct/union //Error 2 error C2228: left of '.x' must have class/struct/union


I am trying to initialize the variables position and x of "spriteObj[5].position.x", But How to I declare x as a member of position as a member of spriteObj[5]?




Aucun commentaire:

Enregistrer un commentaire