Link to home
Start Free TrialLog in
Avatar of jjthorne
jjthorneFlag for Germany

asked on

Passing a struct from 1 C++ Class file to a second C++ Class File

I have this struct

typedef struct                                          // Create A Structure For Star
{
      int r, g, b;                                    // Stars Color
      GLfloat dist;                                    // Stars Distance From Center
      GLfloat angle;                                    // Stars Current Angle
}
stars;                                                // Structures Name Is Stars
stars star[num];                                    // Make 'star' Array Of 'num' Using Info From The Structure 'stars'

which is is the main.cpp file but declared before methods open, and it is altered in the main.cpp, and i want it passed through this line

OnTimer(hDC, texture, loop, num, zoom, tilt, spin); which calls the graphics.cpp file and runs the Ontimer Method,

i also have this declared at the top of the main.cpp file

void OnTimer(HDC hDC, GLuint texture[], GLuint loop, int num, GLfloat zoom, GLfloat tilt, GLfloat spin);                           // Draw OpenGL Scene

as you can see its a OpenGL program which i am trying to create and i just want to pass the struct of veriables from the main.cpp to the graphics.cpp so i can reuse the main.cpp and all i need to do is alter the graphics.cpp file to get a different output of the screen but i cant figure out how to pass the struct from 1 file class t oa second file class
ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jjthorne

ASKER

ah right yeah, im just getting back into c++, i have been programming in c# and java for the past 4 years, and i decided last weeks to try and get back into C++ and openGL, cheers for the help.
Glad to be of assistance. Do not hesitate to ask for clarifications if there are further problems/questions about this.