Skip to content

Commit

Permalink
giving back the winner
Browse files Browse the repository at this point in the history
  • Loading branch information
palffybalazs committed May 19, 2019
1 parent 8ebc192 commit 9e0575b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
18 changes: 18 additions & 0 deletions gammadraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,32 @@ gammadraw::gammadraw(string szin, string szam, gammamester* logika)
this->y=1;
this->logika = logika;
meret = stoi(szam);
this->vege = false;
}
void gammadraw::draw()
{

this->negyzetracsrajzolo();
this->lepesrajzolo();
cout<<"nincs vege";
if(vege)
{
cout<<"vege";
gout<<color(0,0,0);
gout<<move_to(0,0)<<box(900,900);
gout<<color(255,255,255);
gout<<move_to(1,20)<<text("Jateknak vege, gyoztes a(z):");
gout<<move_to(1,40)<<text(this->logika->nyertesszin);

}


}

void gammadraw::negyzetracsrajzolo()
{
vege = this->logika->win;

for(int j=0; j<meret; j++)
{
for(int i=0; i<meret; i++)
Expand All @@ -52,6 +69,7 @@ void gammadraw::negyzetracsrajzolo()
gout<<move_to(x,j*this->negyzetmeret)<<box(this->negyzetmeret,this->negyzetmeret);
gout<<color(0,0,0);
gout<<move_to(x+2,j*this->negyzetmeret+2)<<box(this->negyzetmeret-3, this->negyzetmeret-3);

}
}
}
Expand Down
1 change: 1 addition & 0 deletions gammadraw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ class gammadraw : public Widget
std::string szamlalo;
int negyzetmeret;
bool focus = false;
bool vege = false;
};
#endif // NUMERIC_HPP_INCLUDED
4 changes: 2 additions & 2 deletions gammamester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ bool gammamester::gameover()
this->win = true;
if(adat[i].kor)
{
nyertesszin = "haromszog";
this->nyertesszin = "haromszog jelu jatekos";
}
else
{
nyertesszin = "x";
this->nyertesszin = "x jelu jatekos";
}
}
}
Expand Down
1 change: 1 addition & 0 deletions gammamester.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class gammamester
int hanykellnyerni;
std::vector<koord> mostani_allas();
std::vector<koord> adat;
std::string nyertesszin;
bool win = false;
int fugg;
int viz;
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int main()
gout<<move_to(240,100)<<box(120,20);
gout<<color(0,0,0);
gout<<move_to(280,113)<<text("Mehet");
if(ev.pos_x>240 && ev.pos_x<360 && ev.pos_y>100 && ev.pos_y<120 && ev.button == btn_left)
if(ev.pos_x>240 && ev.pos_x<360 && ev.pos_y>100 && ev.pos_y<120 && ev.buttot)
{
logika = new gammamester(); //game logic started
mehet = true;
Expand Down

0 comments on commit 9e0575b

Please sign in to comment.