Let me preface this with letting you know that I am very new to c++ and programming in general, so my whole thought process may be completely wrong. I have been going through chapter 5, and I have to be honest, I am a bit lost. It seems to go through examples very fast, and I am struggling going over the source code, and linking them to what I see in the book. Here are my questions, please be gentle:
1. There are 3 files in the source code. There is GameCode.h, GameCode.cpp and GameCode4.cpp. GameCode.cpp is quite long, and has a lot of functions in it. I see it is where the members for the GameCodeApp is set up, however, I am a bit confused. Why does it not include GameCode.h? And how does it have access to those definitions without the includes? In fact, I can't seem to find anything that includes the GameCode.cpp either, it seems everything is running from the GameCode4.cpp, but I feel like I am just missing a key something.
2. I see that there are a lot of includes files that the book has not gone over yet. I am looking at this book as kind of a straight up tutorial, and would like to be able to compile my code to check if I have syntax errors and typo's as I go. Typing out the code helping reinforce the concepts, and helps me understand how it all comes together, then I have my own projects where I try out the ideas in other ways. However, in order to get it to compile, do I have to go through all the included files? For example:
GameCode.h has:
#include "../Mainloop/Initialization.h"
#include "../GameCode4/BaseGameLogic.h"
#include "../Graphics3D/SceneNodes.h"
#include "../UserInterface/UserInterface.h"
And GameCode.cpp has:
#include "GameCodeStd.h"
#include "Dbt.h" // required for DBT_DEVICEREMOVECOMPLETE
#include "../MainLoop/Initialization.h"
#include "../Debugging/MiniDump.h"
#include "../GameCode4/BaseGameLogic.h"
#include "../Graphics3D/D3DRenderer.h"
#include "../EventManager/EventManagerImpl.h"
#include "../Network/Network.h"
#include "../LUAScripting/LuaStateManager.h"
#include "../LUAScripting/ScriptExports.h"
#include "../LUAScripting/ScriptProcess.h"
#include "../ResourceCache/ResCache.h"
#include "../ResourceCache/XmlResource.h"
#include "../UserInterface/UserInterface.h"
#include "../UserInterface/MessageBox.h"
#include "../UserInterface/HumanView.h"
#include "../Utilities/Math.h"
#include "../Utilities/String.h"
#include "../Actors/BaseScriptComponent.h"
Now, I have tried to just power through chapter 5, just skimming the book code examples, hoping that it will all come together, but I still feel a bit lost, as if I am again, missing some key thought process.
3. One last question: In GameCode.h I see this near the start of the file:
class FontHandler;
class BaseUI;
class EventManager;
class LuaStateManager;
class BaseSocketManager;
class NetworkEventForwarder;
class HumanView;
I understand that these classes are being declared, but not defined. However, some of these classes are never mentioned again, such as
class FontHandler; in this file, or in the GameCode4.cpp. Is this a class that other files created will rely on? And where exactly are they defined? I can't seem to find anything that defines them, and references this file.
Thank you for your help and patience, a lot of my questions may just show my total lack of understanding, but I appreciate the help as I work through this.
1. There are 3 files in the source code. There is GameCode.h, GameCode.cpp and GameCode4.cpp. GameCode.cpp is quite long, and has a lot of functions in it. I see it is where the members for the GameCodeApp is set up, however, I am a bit confused. Why does it not include GameCode.h? And how does it have access to those definitions without the includes? In fact, I can't seem to find anything that includes the GameCode.cpp either, it seems everything is running from the GameCode4.cpp, but I feel like I am just missing a key something.
2. I see that there are a lot of includes files that the book has not gone over yet. I am looking at this book as kind of a straight up tutorial, and would like to be able to compile my code to check if I have syntax errors and typo's as I go. Typing out the code helping reinforce the concepts, and helps me understand how it all comes together, then I have my own projects where I try out the ideas in other ways. However, in order to get it to compile, do I have to go through all the included files? For example:
GameCode.h has:
#include "../Mainloop/Initialization.h"
#include "../GameCode4/BaseGameLogic.h"
#include "../Graphics3D/SceneNodes.h"
#include "../UserInterface/UserInterface.h"
And GameCode.cpp has:
#include "GameCodeStd.h"
#include "Dbt.h" // required for DBT_DEVICEREMOVECOMPLETE
#include "../MainLoop/Initialization.h"
#include "../Debugging/MiniDump.h"
#include "../GameCode4/BaseGameLogic.h"
#include "../Graphics3D/D3DRenderer.h"
#include "../EventManager/EventManagerImpl.h"
#include "../Network/Network.h"
#include "../LUAScripting/LuaStateManager.h"
#include "../LUAScripting/ScriptExports.h"
#include "../LUAScripting/ScriptProcess.h"
#include "../ResourceCache/ResCache.h"
#include "../ResourceCache/XmlResource.h"
#include "../UserInterface/UserInterface.h"
#include "../UserInterface/MessageBox.h"
#include "../UserInterface/HumanView.h"
#include "../Utilities/Math.h"
#include "../Utilities/String.h"
#include "../Actors/BaseScriptComponent.h"
Now, I have tried to just power through chapter 5, just skimming the book code examples, hoping that it will all come together, but I still feel a bit lost, as if I am again, missing some key thought process.
3. One last question: In GameCode.h I see this near the start of the file:
class FontHandler;
class BaseUI;
class EventManager;
class LuaStateManager;
class BaseSocketManager;
class NetworkEventForwarder;
class HumanView;
I understand that these classes are being declared, but not defined. However, some of these classes are never mentioned again, such as
class FontHandler; in this file, or in the GameCode4.cpp. Is this a class that other files created will rely on? And where exactly are they defined? I can't seem to find anything that defines them, and references this file.
Thank you for your help and patience, a lot of my questions may just show my total lack of understanding, but I appreciate the help as I work through this.
Birdemic