Sorry this is a noob question but, I am trying to have one main function (like in the tech demo), but i'm confused on how to do it. I want to have a bunch of c files all with functions and then the main function that just draws everything using the functions. I know you could use classes, but i'm very confused with them. Could i just possibly do #include <source.cpp>? Thanks of the help
~~ The Robomaniac
Classes?
-
- Posts: 602
- Joined: Sat Aug 23, 2003 2:03 am
- Location: Pottstown, PA
- Contact:
you could write a header file with all the functions declared as extern e.g.
Code: Select all
extern void drawHUD( void );
Great Engine, Niko, keep up the good work!
-
- Posts: 602
- Joined: Sat Aug 23, 2003 2:03 am
- Location: Pottstown, PA
- Contact:
-
- Posts: 602
- Joined: Sat Aug 23, 2003 2:03 am
- Location: Pottstown, PA
- Contact:
-
- Posts: 602
- Joined: Sat Aug 23, 2003 2:03 am
- Location: Pottstown, PA
- Contact:
Got it sort of, except i don't want to have to declare like driver and smgr and device in all the cpp files. right now, i have one header that has the declarations (ex. extern void loadGUIGraphics) and then cpp files with the functions (ex. in GUIGraphFunctions.cpp... the function loadGUIGraphics). I want to have a function for every process i have. So far i have this list :
drawWindow();
loadGUIGraphics();
loadGUIModel();
renderGUI();
checkGUI();
loadMap();
loadModels();
drawScene();
all of those are in main. I compile and i get errors like
`device' undeclared (first use this function)
and
`driver' undeclared (first use this function)
Do i have to put all of my functions into one file. Say have a file like GUI.cpp and then put drawWindow, loadGUIGraphics, loadGUIModel, etc, etc. into that file or can i have different c files. Thanks for any help
~~ The Robomaniac
drawWindow();
loadGUIGraphics();
loadGUIModel();
renderGUI();
checkGUI();
loadMap();
loadModels();
drawScene();
all of those are in main. I compile and i get errors like
`device' undeclared (first use this function)
and
`driver' undeclared (first use this function)
Do i have to put all of my functions into one file. Say have a file like GUI.cpp and then put drawWindow, loadGUIGraphics, loadGUIModel, etc, etc. into that file or can i have different c files. Thanks for any help
~~ The Robomaniac
-
- Posts: 271
- Joined: Sat Aug 23, 2003 5:52 pm
- Location: Hurricane Central, Florida