I make a simple drawing on Pascal. You need to make a drawing mode (done), an eraser mode (done), and a mode just moving the brush without drawing (I can't). Tell me, how can this be done?
uses graphabc,crt,events; var x,y:integer; c:char; drawmode: string; const WH = 600; WW = 600; color_px = clBlack; procedure draw_px(col:integer); begin SetPenColor(col); SetBrushColor(col); rectangle(x,y,x+10,y+10) end; procedure kDown(key: integer); { ????????? ????????? ??????? ?????? } begin if drawmode = 'no' then draw_px(clWhite); if key=VK_Left then x:=x-10; { ????? } if key=VK_Right then x:=x+10; { ?????? } if key=VK_Up then y:=y-10; { ????? } if key=VK_Down then y:=y+10; { ???? } if key=VK_Escape then CloseWindow; { ??????? ???? } if key=VK_Space then begin if drawmode = 'yes' then drawmode:='no' else if drawmode = 'no' then drawmode:='yes'; end; SetWindowCaption('x='+IntToStr(x)+' y='+IntToStr(y) + ' flag=' + drawmode); draw_px(clBlack); end; begin setWindowSize(WH,WW); x := WW div 2; y := WH div 2; drawmode:= 'yes'; OnKeyDown:=kDown; end.