From e37d4911c750550896c4155f452736200d977b83 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Mon, 16 Jan 2023 02:51:22 -0500 Subject: Almost done... --- canevas.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'canevas.cpp') diff --git a/canevas.cpp b/canevas.cpp index 959e681..edcb8be 100644 --- a/canevas.cpp +++ b/canevas.cpp @@ -10,7 +10,7 @@ Canevas::Canevas() { Couche couches[MAX_COUCHES]; - couches[0].changerEtat(STATE_ACTIVE); + activerCouche(0); } Canevas::~Canevas() { @@ -37,13 +37,6 @@ bool Canevas::activerCouche(int index) { return couches[index].changerEtat(STATE_ACTIVE); }; -bool Canevas::cacherCouche(int index) { - if (index < 0 || index >= MAX_COUCHES) - return false; - couches[index].changerEtat(STATE_INACTIVE); - return true; -}; - bool Canevas::ajouterForme(Forme *p_forme) { int active = -1; for (int i = 0; i < MAX_COUCHES; i++) @@ -88,6 +81,15 @@ void Canevas::afficher(ostream & s) { }; }; +void Canevas::getEtats(ostream &s) { + s << "[ "; + for (int i = 0; i < MAX_COUCHES; i++) { + s << STATES[couches[i].getEtat()]; + if (i < MAX_COUCHES - 1) s << ", "; + else s << " ]\n"; + }; +} + bool Canevas::reinitialiserCouche(int index) { if (index < 0 || index >= MAX_COUCHES){ return false; -- cgit v1.2.3