How can I access a pointer, box in this code, from in a different function, such as this code's update gameloop?
int main()
{
ScenePrimitive *box = new ScenePrimitive(ScenePrimitive::TYPE_BOX, 1,1,1);
}
int update()
{
cout box;
}
|
How can I access a pointer,
int main()
{
ScenePrimitive *box = new ScenePrimitive(ScenePrimitive::TYPE_BOX, 1,1,1);
}
int update()
{
cout box;
}
|
|||||||||||||
|
Questions on Game Development Stack Exchange are expected to relate to game development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.
|
You could use a global variable for your sceneprimtive:
OR take the sceneprimitive as an parameter of your update function:
|
|||
|