-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCheckers.Mod.txt
47 lines (40 loc) · 1.54 KB
/
Checkers.Mod.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
MODULE Checkers; (*NW 4.10.90 / 10.3.2013*)
IMPORT SYSTEM, Display, Viewers, Oberon, MenuViewers, TextFrames;
TYPE Frame = POINTER TO FrameDesc;
FrameDesc = RECORD (Display.FrameDesc)
col: INTEGER
END ;
VAR i: INTEGER;
checks: INTEGER;
pat: ARRAY 17 OF INTEGER;
PROCEDURE Restore(F: Frame);
BEGIN Oberon.RemoveMarks(F.X, F.Y, F.W, F.H);
Display.ReplConst(Display.black, F.X, F.Y, F.W, F.H, Display.replace); (*clear*)
Display.ReplPattern(F.col, checks, F.X+1, F.Y, F.W-1, F.H-1, Display.paint)
END Restore;
PROCEDURE Handle(G: Display.Frame; VAR M: Display.FrameMsg);
VAR G1: Frame;
BEGIN
CASE G OF Frame:
CASE M OF
Oberon.InputMsg:
IF M.id = Oberon.track THEN Oberon.DrawMouseArrow(M.X, M.Y) END |
Oberon.CopyMsg:
Oberon.RemoveMarks(G.X, G.Y, G.W, G.H); NEW(G1); G1^ := G^; M.F := G1 |
MenuViewers.ModifyMsg:
IF (M.Y # G.Y) OR (M.H # G.H) THEN G.Y := M.Y; G.H := M.H; Restore(G) END
END
END
END Handle;
PROCEDURE Open*;
VAR F: Frame; V: Viewers.Viewer; X, Y: INTEGER;
BEGIN NEW(F); F.col := 14; F.handle := Handle;
Oberon.AllocateUserViewer(Oberon.Par.vwr.X, X, Y);
V := MenuViewers.New(
TextFrames.NewMenu("CheckerViewer", "System.Close System.Copy System.Grow"),
F, TextFrames.menuH, X, Y)
END Open;
BEGIN checks := SYSTEM.ADR(pat); pat[0] := 1010H; i := 1;
REPEAT pat[i] := 0FF00FFH; INC(i) UNTIL i = 9;
REPEAT pat[i] := 0FF00FF00H; INC(i) UNTIL i = 17
END Checkers.