Bonsoir,
Alors, depuis hier, j'ai fait un sous-moteur à la lib SFML.
Sauf que je voudrais utiliser une liste (array sans limite) de type DrawUnit, qui est une class contenant une fonction drawOnTheWindow pour le moment.
Et j'ai une belle erreur de la part de Visual ... Donc si quelqu'un peux m'éclairer
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #ifndef DEF_DRAWCLASS #define DEF_DRAWCLASS #include <SFML/Graphics.hpp> #include <vector> #include "DrawUnit.h" using namespace sf; class DrawClass { private: std::vector<DrawUnit*> liste_to_draw; public: DrawClass(); ~DrawClass(); void drawAll(RenderWindow* window); int add_elem(DrawUnit* toAdd); void remove_elem(int index); }; #endif
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 #include "DrawClass.h" DrawClass::DrawClass() { } DrawClass::~DrawClass() { } void DrawClass::drawAll(RenderWindow* window) { int i = 0; for (i = 0; i < (int)liste_to_draw.capacity(); i++) { liste_to_draw[i]->drawOnTheWindow();//Erreur ici } } int DrawClass::add_elem(DrawUnit* toAdd) { liste_to_draw.push_back(toAdd); return liste_to_draw.end() - liste_to_draw.begin(); } void DrawClass::remove_elem(int index) { liste_to_draw.erase(liste_to_draw.begin() + index); }
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #ifndef DEF_DRAWUNIT #define DEF_DRAWUNIT #include <SFML/Graphics.hpp> using namespace sf; class DrawUnit { private: public : int drawOnTheWindow();//RenderWindow* window); }; #endif
L'erreur :Code:
1
2
3
4
5
6
7
8 #include "DrawUnit.h" int drawOnTheWindow()//(RenderWindow* window) { //window->clear(); return 0; }
ps : ça serais simpa aussi de dire s'il y a des trucs fais "bizarrement" car je passe du vb.net au C++, ça change ..Code:Error 1 error LNK2019: unresolved external symbol "public: int __thiscall DrawUnit::drawOnTheWindow(void)" (?drawOnTheWindow@DrawUnit@@QAEHXZ) referenced in function "public: void __thiscall DrawClass::drawAll(class sf::RenderWindow *)" (?drawAll@DrawClass@@QAEXPAVRenderWindow@sf@@@Z) C:\Users\Nico\Documents\Visual Studio 2010\Projects\SFML\SFML\DrawClass.obj SFML
Merci :)