Hello, I'm trying to create my own game engine, and ran into a problem with nested classes.
Currently, I only have one class that has any methods:
#ifndef WINDOWMANAGER_H_
#define WINDOWMANAGER_H_
#include <SFML/Graphics.hpp>
#include <string>
namespace tnt
{
class Engine
{
public:
class GeneralCore
{
public:
class WindowManager
{
private:
sf::RenderWindow MainWindow;
int windowHeight;
int windowWidth;
int windowBPP;
std::string windowTitle;
public:
WindowManager();
WindowManager(int width, int height, int bpp, std::string title);
void ChangeWindowSize(int newWidth, int newHeight);
void ChangeWindowTitle(std::string newTitle);
void SwapBuffer();
void DisplayWindow();
};
};
};
}
#endif
Am I not nesting the classes right? It compiles fine on MSVC++ 2008.
When I try to access the window manager instance from main like this:
#include "TNTengine.h"
using namespace tnt;
int main(int argc, char* args[])
{
Engine myEngine;
bool running = true;
while(running)
myEngine.GeneralCore.WindowManager.DisplayWindow();
return 0;
}
MSVC++ gives compiler errors like "left of '.WindowManager' must have class/struct/union"
Am I not setting up the classes right? Or is it something else?
Thanks in advance
~Asian
EDIT: I want to declare the other classes else where. Thanks again