1 #include <graphics/clip.h>
2 #include <graphics/gfx.h>
4 #include <proto/layers.h>
5 #include <proto/exec.h>
9 struct Library
*LayersBase
;
10 struct Layer dummy_lay
;
12 struct ClipRect dummy_cr
[100];
14 void setcr(WORD which
, WORD x1
, WORD y1
, WORD x2
, WORD y2
)
16 dummy_cr
[which
].bounds
.MinX
= x1
;
17 dummy_cr
[which
].bounds
.MinY
= y1
;
18 dummy_cr
[which
].bounds
.MaxX
= x2
;
19 dummy_cr
[which
].bounds
.MaxY
= y2
;
20 dummy_cr
[which
].Flags
= which
;
22 if (which
> 0) dummy_cr
[which
- 1].Next
= &dummy_cr
[which
];
27 /* 0000000000011111111122
28 0123456789012345678901
30 00 +---+---+------------+
33 03 | | 1 +---+--------+
37 07 +---+---+ 8 +--------+
39 09 +-------+---+--------+
42 setcr(0, 0, 0, 39, 19);
43 setcr(1, 40, 0, 79, 69);
44 setcr(2, 80, 0, 209, 29);
45 setcr(3, 0, 20, 39, 49);
46 setcr(4, 80, 30, 119, 49);
47 setcr(5, 120, 30, 209, 69);
48 setcr(6, 0, 50, 39, 69);
49 setcr(7, 0, 70, 79, 89);
50 setcr(8, 80, 50, 119, 89);
51 setcr(9, 120, 70, 209, 89);
53 dummy_lay
.ClipRect
= dummy_cr
;
56 void doit(char *msg
, WORD dx
, WORD dy
)
60 SortLayerCR(&dummy_lay
, dx
, dy
);
62 printf("\n%s\n----------------------------\n", msg
);
63 cr
= dummy_lay
.ClipRect
;
66 printf("%ld ", cr
->Flags
);
79 doit("UP LEFT", -1, -1);
80 doit("UP RIGHT", 1, -1);
81 doit("DOWN LEFT", -1, 1);
82 doit("DOWN RIGHT", 1, 1);
88 LayersBase
= OpenLibrary("layers.library", 0);
94 CloseLibrary(LayersBase
);