Advertisement

Using an extern, and shifting code.

Started by January 26, 2003 05:17 PM
0 comments, last by m_wherrett 21 years, 9 months ago
I''m afraid I''ve got two questions in this post but they are fairly straightforward. 1. I''ve got a fairly simple game using only a few objects and variables that interact. The trouble is whenver I update and draw a lot of the objects I end up passing the game time to them so they can calculate their movement. Am I right in thinking that things like my ''m_gametime'' variable can be made global using externs? Is so, how? 2. My Main() cpp file is getting quite crowded and I''d like to shift some of the code into another file. Bits like the keyboard control code which, incidentally, operates upon objects declared in that main piece. How can I shift the code to another file whilst allowing it to recognise which objects are being operated on? Will externs help me here too? I''m fairly sure these are simple questions and would welcome any response on the matter. cheers in advance people.
Look here Modular Design,
here Organizing Source Files and here Writing Readable Code

This should give you a god start,
Pat

This topic is closed to new replies.

Advertisement