Hi,
I had almost completed my program of Analog clock with tC++. but i got stuck, when any arm of the clock is over another arm it erase the other arm when it passess by. I try to redraw that arm but it looks very bad as it start blinking when two arms are close to each other. Is there any way to stop that blinking.
I have created a class for arm with following functions:
set(start_angle,color,size)
draw();
erase();
move(angle);

I am new to C++,kindly help me.

Thanks

If you are going to erase and redraw without sufficient time interval in between, it will cause blinking which is visible. You don't need to draw anything until the position of the second hand changes, i.e. after each second. Whenever you cange the position of ANY hand , erase and redraw all of them. Since there is a gap of second between each redraw, it won't be much visible.
I've written the same program. Its in the snippets section. You might want to check that out.

Thanks,

But if i tiried to redraw each arm every second it looks more blinky. what i have done is that i continuosly check wether the the value of each arm is changed or not, if yes i redraw it with new position and if no i just leave as it is. I took 2 variables for each arm: old_value and new_value when old_value(present value) is different from new_value(continues value checked) i redraw it.

But how to make sure that one arm is on other.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.