Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion include/draw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*/

#endif /* DRAW_HPP*/
3 changes: 2 additions & 1 deletion include/jeu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ class Jeu {
InventoryRenderer m_invRender;
Coord m_mousePosCam;
Coord m_mousePosWorld;
Texture texture;

public:
Jeu(Texture &texture);
Jeu();

void run();

Expand Down
25 changes: 13 additions & 12 deletions src/jeu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}