A
A
amalchikov2016-02-16 01:01:44
Command line
amalchikov, 2016-02-16 01:01:44

Why doesn't redraw work?

Hello!
I'm learning C++, using console graphics msofcon.h.
I realized that if two drawings are superimposed on each other, it turns out to be nonsense. The drawing begins to occupy neighboring cells with the one already drawn before it.
There is a traffic light.
It is drawn using the following method:

svetofor::svetofor(int xcen,int ycen)//конструктор светофора
{
  radius=1;
  set_color(cGREEN,cGREEN);
  draw_circle(xcen+otsx,ycen+otsy,radius);
}

when calling the change method, I want to erase it, and make it not green, but red.
here is the method:
void svetofor::change(int c)//меняем цвет сетофора по команде
{
  if (c==1){
        set_color(cBLACK,cBLACK);
  draw_circle(xcen+otsx,ycen+otsy,1);
  set_color(cGREEN,cGREEN);
  draw_circle(xcen+otsx,ycen+otsy,1);
  }
  else
  {
  set_color(cBLACK,cBLACK);
  draw_circle(xcen+otsx,ycen+otsy,1);
  set_color(cRED,cRED);
  draw_circle(xcen+otsx,ycen+otsy,1);
  }

}

That doesn't work. Also, for some reason, set_cursor_pos does not work.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question