Mam sobie klasę:
#pragma once
#include <iostream>
#include <string>
#include<map>
#include "GameScreen.h"
#include "SplashScreen.h"
#include "MenuScreen.h"
//Allegro Inits
#include <allegro5\allegro.h>
#include <allegro5\allegro_image.h>
#include <map>
#define ScreenWidth 800
#define ScreenHeight 600
class ScreenManager
{
private:
ScreenManager();
ScreenManager(ScreenManager const&);
void operator=(ScreenManager const&);
GameScreen *currentScreen;
std::map<std::string, GameScreen*> screenDirectory;
public:
~ScreenManager();
static ScreenManager &GetInstance();
void AddScreen(std::string newScreen);
void Initialize();
void LoadContent();
void UnloadContent();
void Update(ALLEGRO_EVENT ev);
void Draw(ALLEGRO_DISPLAY *display);
};
I klasę:
#pragma once
#include <allegro5\allegro.h>
#include <allegro5\allegro_image.h>
#include <allegro5\allegro_font.h>
#include <allegro5\allegro_ttf.h>
#include "FileManager.h"
#include "InputManager.h"
#include "ScreenManager.h"
class MenuManager
{
private:
FileManager fileManager;
InputManager input;
std::vector<std::string> attributes;
std::vector<std::vector<std::string>> contents;
ALLEGRO_BITMAP* image;
ALLEGRO_FONT* font;
std::vector<std::string> items;
std::vector<std::pair<float,float>> position;
std::vector<std::string> menuLinks;
std::pair<float,float> newImageSize;
std::pair<float,float> imageSize;
int align;
int active;
int itemColor;
int itemNumber;
void SetItems();
public:
MenuManager(void);
~MenuManager(void);
void LoadContent(std::string idMenu);
void UnloadContent();
void Update(ALLEGRO_EVENT ev);
void Draw(ALLEGRO_DISPLAY *display);
};
Gdy wstawiam #include"ScreenManager" do tej klasy:
#pragma once
#include <allegro5\allegro.h>
#include <allegro5\allegro_font.h>
#include <allegro5\allegro_ttf.h>
#include "GameScreen.h"
#include "MenuManager.h"
class MenuScreen : public GameScreen
{
private:
MenuManager menu;
public:
MenuScreen(void);
~MenuScreen(void);
void LoadContent();
void UnloadContent();
void Update(ALLEGRO_EVENT ev);
void Draw(ALLEGRO_DISPLAY *display);
};
Otrzymuję błąd: Error 1 error C2146: syntax error : missing ';' before identifier 'menu
Nie wiem gdzie leży problem, dodaję jeszcze jedną klasę:
#pragma once
#include<allegro5\allegro.h>
#include<vector>
#include"InputManager.h"
#include"FileManager.h"
class GameScreen
{
protected:
InputManager input;
FileManager fileManager;
std::vector<std::string> attributes;
std::vector<std::vector<std::string>> contents;
public:
GameScreen();
~GameScreen();
virtual void LoadContent();
virtual void UnloadContent();
virtual void Update(ALLEGRO_EVENT ev);
virtual void Draw(ALLEGRO_DISPLAY *display);
};