Skip to content

Commit

Permalink
triangle and x marks in separate functions
Browse files Browse the repository at this point in the history
  • Loading branch information
palffybalazs committed May 19, 2019
1 parent 01497d8 commit 8ebc192
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 27 deletions.
65 changes: 38 additions & 27 deletions gammadraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,36 +61,14 @@ void gammadraw::lepesrajzolo()
vector<koord> mostani_allas = logika->mostani_allas();
for(int f=0; f<mostani_allas.size(); f++)
{
if(loves && mostani_allas[f].kor == false)
koord actjelzes = mostani_allas[f];
if(loves && actjelzes.kor == false)
{
if(szin == "kek") //ha kekkel vagyunk, ellenfel zold
{
gout<<color(0,255,0);
}
if(szin == "zold")
{
gout<<color(0,0,255);
}
gout<<move_to(mostani_allas[f].v*this->negyzetmeret,mostani_allas[f].f*this->negyzetmeret);
gout<<line_to(mostani_allas[f].v*this->negyzetmeret+this->negyzetmeret,mostani_allas[f].f*this->negyzetmeret+this->negyzetmeret);
gout<<move_to(mostani_allas[f].v*this->negyzetmeret+this->negyzetmeret,mostani_allas[f].f*this->negyzetmeret);
gout<<line_to(mostani_allas[f].v*this->negyzetmeret,mostani_allas[f].f*this->negyzetmeret+this->negyzetmeret);
haromszograjzolo(actjelzes);
}
if(loves && mostani_allas[f].kor == true)
if(loves && actjelzes.kor == true)
{
if(szin == "kek")
{
gout<<color(0,0,255);
}
if(szin == "zold")
{
gout<<color(0,255,0);
}
gout<<move_to(mostani_allas[f].v*this->negyzetmeret,mostani_allas[f].f*this->negyzetmeret+this->negyzetmeret);
gout<<line_to(mostani_allas[f].v*this->negyzetmeret+15,mostani_allas[f].f*this->negyzetmeret);
gout<<line_to(mostani_allas[f].v*this->negyzetmeret+this->negyzetmeret,mostani_allas[f].f*this->negyzetmeret+this->negyzetmeret);
gout<<move_to(mostani_allas[f].v*this->negyzetmeret,mostani_allas[f].f*this->negyzetmeret+this->negyzetmeret);
gout<<line_to(mostani_allas[f].v*this->negyzetmeret+this->negyzetmeret,mostani_allas[f].f*this->negyzetmeret+this->negyzetmeret);
xrajzolo(actjelzes);
}
}
}
Expand Down Expand Up @@ -122,3 +100,36 @@ bool gammadraw::handle(genv::event ev, bool focused)
}
}
}

void gammadraw::haromszograjzolo(koord actjelzes)
{
if(this->szin == "kek") //ha kekkel vagyunk, ellenfel zold
{
gout<<color(0,255,0);
}
if(this->szin == "zold")
{
gout<<color(0,0,255);
}
gout<<move_to(actjelzes.v*this->negyzetmeret,actjelzes.f*this->negyzetmeret);
gout<<line_to(actjelzes.v*this->negyzetmeret+this->negyzetmeret,actjelzes.f*this->negyzetmeret+this->negyzetmeret);
gout<<move_to(actjelzes.v*this->negyzetmeret+this->negyzetmeret,actjelzes.f*this->negyzetmeret);
gout<<line_to(actjelzes.v*this->negyzetmeret,actjelzes.f*this->negyzetmeret+this->negyzetmeret);
}

void gammadraw::xrajzolo(koord actjelzes)
{
if(this->szin == "kek")
{
gout<<color(0,0,255);
}
if(this->szin == "zold")
{
gout<<color(0,255,0);
}
gout<<move_to(actjelzes.v*this->negyzetmeret,actjelzes.f*this->negyzetmeret+this->negyzetmeret);
gout<<line_to(actjelzes.v*this->negyzetmeret+15,actjelzes.f*this->negyzetmeret);
gout<<line_to(actjelzes.v*this->negyzetmeret+this->negyzetmeret,actjelzes.f*this->negyzetmeret+this->negyzetmeret);
gout<<move_to(actjelzes.v*this->negyzetmeret,actjelzes.f*this->negyzetmeret+this->negyzetmeret);
gout<<line_to(actjelzes.v*this->negyzetmeret+this->negyzetmeret,actjelzes.f*this->negyzetmeret+this->negyzetmeret);
}
2 changes: 2 additions & 0 deletions gammadraw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class gammadraw : public Widget
bool handle(genv::event ev, bool focused);
void negyzetracsrajzolo();
void lepesrajzolo();
void xrajzolo(koord actjelzes);
void haromszograjzolo(koord actjelzes);
std::string returnchosen();
std::vector<koord>adat;
bool kor = true;
Expand Down

0 comments on commit 8ebc192

Please sign in to comment.