Hey all,
I recently started developing my own game engine (just for fun), but I've run into a really weird error when implementing abstract classes. To help you all understand the issue I'm having, I've attached a simply UML diagram of how my game engine currently works (subject to change).
[spoiler][/spoiler]
This is a pretty simple design. My engine initializes and keeps track of several different modules or components called managers. Each individual manager needs access to some of the same types of information, so I thought it'd be easiest to create an abstract class that they all derive from. The abstract class contains a constructor, an init() function (this is the abstract function that all managers should override), a reference to the manager, and a reference to the engine.
I'm using Visual Studio 2013, and in the viewport I see no errors of any kind. I'm pretty sure I've implemented this correctly, but when I try to compile, I get a slew of different kinds of errors (mostly syntax) that reference "blank" spots in the code.
Here's the full list of errors:
[spoiler][/spoiler]
If you reference these areas of the code, they all point to the beginning of a line, and their description makes little sense in the context. The 3 main headers that are receiving these errors are BuddyEngine.h, Manager.h, and RenderManager.h. I'll post the code for you to see. These are all pretty simple implementations.
BuddyEngine.h
[spoiler]
#pragma once
#ifndef BUDDYENGINE_H
#define BUDDYENGINE_H
#include "RenderManager.h"
//#include "InputComponent.h"
//#include "SoundComponent.h"
class BuddyEngine {
public:
BuddyEngine(int argc, char **argv);
RenderManager& getRenderManager();
static BuddyEngine& getInstance();
private:
RenderManager* renderManager;
static BuddyEngine* instance;
};
#endif
[/spoiler]
Manager.h
[spoiler]
#pragma once
#ifndef MANAGER_H
#define MANAGER_H
#include "BuddyEngine.h"
class Manager {
public:
Manager(BuddyEngine* engine, int argc, char **argv);
BuddyEngine& getBuddyEngine();
static Manager& getInstance();
private:
BuddyEngine* buddyEngine;
static Manager* instance;
virtual bool init(int argc, char **argv) = 0;
};
#endif
[/spoiler]
RenderManager.h
[spoiler]
#pragma once
#ifndef RENDERMANAGER_H
#define RENDERMANAGER_H
#include "Manager.h"
#include "WorldRender.h"
class RenderManager : public Manager {
public:
RenderManager(BuddyEngine* engine, int argc, char **argv) : Manager(engine, argc, argv) {}
GLFWwindow& getWindow();
WorldRender& getWorldRender();
private:
GLFWwindow* window;
WorldRender* worldRender;
virtual bool init(int argc, char **argv);
static void render();
};
#endif
[/spoiler]
I hate having to post lots of code for help, but I'm afraid I've hit a brick wall with this ghost of an issue. If anyone has any ideas of what could be causing these errors, please let me know. If you need me to post the implementations of these functions (.cpp files), I can do that as well. Thanks for reading!