Make main_h and main_w directly set the height and width of edge, and clear the screen before redrawing it.