From 1a6f1fe16ae13b8660fcbeffee148bd275d1d961 Mon Sep 17 00:00:00 2001 From: Cisse PapaElHadjiG Date: Mon, 6 Nov 2023 00:04:55 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Remove=20the=20character=E2=80=99s=20textur?= =?UTF-8?q?e=20in=20jeu=20=20settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/draw.hpp | 2 +- include/jeu.hpp | 3 ++- src/jeu.cpp | 25 +++++++++++++------------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/include/draw.hpp b/include/draw.hpp index c65e5a0..c50c1d3 100644 --- a/include/draw.hpp +++ b/include/draw.hpp @@ -28,4 +28,4 @@ void drawMiniCarte(int x, int y, Color color, RenderWindow *window, int largeur, void drawText(int x, int y, string text, RenderWindow *window, int size, Color color, string fontPath); -#endif /* DRAW_HPP*/ \ No newline at end of file +#endif /* DRAW_HPP*/ diff --git a/include/jeu.hpp b/include/jeu.hpp index 21b6181..dac27eb 100644 --- a/include/jeu.hpp +++ b/include/jeu.hpp @@ -33,9 +33,10 @@ class Jeu { InventoryRenderer m_invRender; Coord m_mousePosCam; Coord m_mousePosWorld; + Texture texture; public: - Jeu(Texture &texture); + Jeu(); void run(); diff --git a/src/jeu.cpp b/src/jeu.cpp index a50a4d9..fecb9c5 100644 --- a/src/jeu.cpp +++ b/src/jeu.cpp @@ -3,15 +3,21 @@ using namespace std; using namespace sf; -Jeu::Jeu(sf::Texture &texture) +Jeu::Jeu() : m_window(VideoMode(WINDOW_WIDTH, WINDOW_HEIGHT), TITRE_FENETRE), - m_char(0, 0, - texture), // Passer la texture (spritesheet) - m_posCam(0, 0), m_inv("../assets/csv/inventory.csv"), m_mousePosCam(0, 0), - m_invRender(m_inv) { - m_map = Map(); + m_char(0, 0, texture), + m_posCam(0, 0), + m_inv("../assets/csv/inventory.csv"), + m_mousePosCam(0, 0), + m_invRender(m_inv) +{ + if (!texture.loadFromFile("../assets/img/personnage.png")) { + cout << "Erreur de chargement de la spritesheet." << endl; + } + m_map = Map(); } + void Jeu::run() { Clock clock; Time timePerFrame = seconds(1.f / FPS_MAX); @@ -191,12 +197,7 @@ void Jeu::save() { m_inv.save("../assets/csv/inventory.csv"); } int main(int arg, char **argv) { - Texture spritesheet; - if (!spritesheet.loadFromFile("../assets/img/personnage.png")) { - cout << "Erreur de chargement de la spritesheet." << endl; - } - - Jeu jeu(spritesheet); + Jeu jeu; jeu.run(); return 0; } From ab87b5bb51e709188cd87d6041c191ec9c1d5eb5 Mon Sep 17 00:00:00 2001 From: Cisse PapaElHadjiG Date: Mon, 6 Nov 2023 00:32:10 +0100 Subject: [PATCH 2/2] Update the stop position of person --- include/draw.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/draw.hpp b/include/draw.hpp index c50c1d3..de03f7d 100644 --- a/include/draw.hpp +++ b/include/draw.hpp @@ -27,5 +27,8 @@ void drawMiniCarte(int x, int y, Color color, RenderWindow *window, int largeur, void drawText(int x, int y, string text, RenderWindow *window, int size, Color color, string fontPath); + +void draw(RenderWindow &window); + #endif /* DRAW_HPP*/