[Oberon] FPGA - DIY Dialogs

Jörg Straube joerg.straube at iaeth.ch
Thu Dec 27 10:44:30 CET 2018


Try to make DrawBox(x0, y0, x1, y1).

Jörg

> Am 26.12.2018 um 23:20 schrieb Tomas Kral <thomas.kral at email.cz>:
> 
> 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>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon



More information about the Oberon mailing list