[Oberon] FPGA - DIY Dialogs

Tomas Kral thomas.kral at email.cz
Wed Dec 26 23:20:42 CET 2018


Hi,

Trying to draw a selection rectangle, aka `marching ants'.
I do this, it makes selection east-rightwards only.
I am surprised I need to call `DrawBox' in three places, 
otherwise it trails visual marks.  I wish to keep the code
minimal. How to make it in all directions?

  PROCEDURE DrawBox(x, y, w, h: INTEGER); (*selection rectangle*)
  BEGIN
    Display.ReplPattern(8, Display1.grey2, x, y, w, 1, Display.invert);
    Display.ReplPattern(8, Display1.grey2, x, y+h-1, w, 1, Display.invert);
    Display.ReplPattern(8, Display1.grey2, x, y, 1, h, Display.invert);
    Display.ReplPattern(8, Display1.grey2, x+w-1, y, 1, h, Display.invert)
  END DrawBox;

  PROCEDURE TrackSelection(M: Oberon.InputMsg); (*eastwards*)
    VAR x, y: INTEGER; keys: SET;
  BEGIN x := M.X; y := M.Y;
    REPEAT
      DrawBox(M.X, M.Y, ABS(M.X-x), ABS(M.Y-y));
      Input.Mouse(keys, x, y); Oberon.DrawMouse(Crosshair, x, y);
      DrawBox(M.X, M.Y, ABS(M.X-x), ABS(M.Y-y))
    UNTIL keys = {};
    DrawBox(M.X, M.Y, ABS(M.X-x), ABS(M.Y-y))
  END TrackSelection;

-- 
Tomas Kral <thomas.kral at email.cz>


More information about the Oberon mailing list