1
Général / [Résolu]echec de composition de deux classes entre elles
« le: Décembre 07, 2013, 04:03:15 pm »
Bonjour,
J'ai un soucie au niveau d'une composition, je souhaiterai simplement déclarer et instancier un objet de classe A en tant qu'attribut d'une classe B.
J'utilise le tuto pour "Manage differents screen in a game"
Je vous met mon code.
cScreen.h
Menu.h
Le probleme ici est qu'il ne reconnais pas HighView "could not be resolved" erreur.
et HighView.h
J'ai un soucie au niveau d'une composition, je souhaiterai simplement déclarer et instancier un objet de classe A en tant qu'attribut d'une classe B.
J'utilise le tuto pour "Manage differents screen in a game"
Je vous met mon code.
cScreen.h
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
using namespace sf;
#ifndef CSCREEN_H_
#define CSCREEN_H_
class cScreen
{
public :
virtual int run(RenderWindow *app)=0;
};
#endif /* CSCREEN_H_ */
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
using namespace sf;
#ifndef CSCREEN_H_
#define CSCREEN_H_
class cScreen
{
public :
virtual int run(RenderWindow *app)=0;
};
#endif /* CSCREEN_H_ */
Menu.h
/*
* Menu.h
*
* Created on: 2 déc. 2013
* Author: Altarrys
*/
#ifndef MENU_H_
#define MENU_H_
#include <exception>
#include <iostream>
#include <windows.h>
#include <cmath>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <fstream>
#include "HighView.h"
#include "cScreen.h"
class Menu : public cScreen
{
private:
HighView vueHaute;
int movement_step;
int posx;
int posy;
int tailleMap;
int spawnX;
int spawnY;
int level[];
int visibility;
Clock clock;
float speed;
float elapsed;
float deplacement;
int i;
public:
Menu (RenderWindow *app);
int run (sf::RenderWindow *app);
};
#endif /* MENU_H_ */
* Menu.h
*
* Created on: 2 déc. 2013
* Author: Altarrys
*/
#ifndef MENU_H_
#define MENU_H_
#include <exception>
#include <iostream>
#include <windows.h>
#include <cmath>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <fstream>
#include "HighView.h"
#include "cScreen.h"
class Menu : public cScreen
{
private:
HighView vueHaute;
int movement_step;
int posx;
int posy;
int tailleMap;
int spawnX;
int spawnY;
int level[];
int visibility;
Clock clock;
float speed;
float elapsed;
float deplacement;
int i;
public:
Menu (RenderWindow *app);
int run (sf::RenderWindow *app);
};
#endif /* MENU_H_ */
Le probleme ici est qu'il ne reconnais pas HighView "could not be resolved" erreur.
et HighView.h
/*
* HighView.h
*
* Created on: 27 nov. 2013
* Author: Utilisateur
*/
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <iostream>
#include "Map.h"
#ifndef HIGHVIEW_H_
#define HIGHVIEW_H_
using namespace sf;
namespace std {
class HighView{
public:
HighView(int visibility, float spawnX, float spawnY);
virtual ~HighView();
void Move(float x, float y);
void Draw(RenderWindow* window, Map map);
private:
View vue;
};
} /* namespace std */
#endif /* HIGHVIEW_H_ */
* HighView.h
*
* Created on: 27 nov. 2013
* Author: Utilisateur
*/
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <iostream>
#include "Map.h"
#ifndef HIGHVIEW_H_
#define HIGHVIEW_H_
using namespace sf;
namespace std {
class HighView{
public:
HighView(int visibility, float spawnX, float spawnY);
virtual ~HighView();
void Move(float x, float y);
void Draw(RenderWindow* window, Map map);
private:
View vue;
};
} /* namespace std */
#endif /* HIGHVIEW_H_ */