-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArea.spin2
More file actions
76 lines (56 loc) · 1.25 KB
/
Area.spin2
File metadata and controls
76 lines (56 loc) · 1.25 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{Area Object}
VAR
long bg_color 'background color
long fg_color 'foreground color
long ol_color 'outline = border
word xtop
word ytop
word xbot
word ybot
long my_event_handler
byte id
OBJ
graphics : "Graphics"
PUB null()
PUB configure(w_id, bg, fg, ol)|b_id
id := w_id
bg_color := bg
fg_color := fg
ol_color := ol
'debug("Area ",udec(id)," configured")
PUB set_id(i)
id := i
PUB set_bg_color(color)
bg_color := color
PUB set_fg_color(color)
fg_color := color
PUB set_ol_color(color)
ol_color := color
PUB get_bg_color():bg
bg := bg_color
PUB get_fg_color():fg
fg := fg_color
PUB get_ol_color():ol
ol := ol_color
PUB set_ys(yt,yb)
ytop := yt
ybot := yb
PUB set_xs(xt,xb)
xtop := xt
xbot := xb
PUB set_coordinates(xt, yt, xb, yb)
xtop := xt
ytop := yt
xbot := xb
ybot := yb
PUB get_coordinates() : xt, yt, xb, yb
xt := xtop
yt := ytop
xb := xbot
yb := ybot
''+--------------------------------------------------------------------+
'' DRAWING METHODS
''+--------------------------------------------------------------------+
PUB draw()
'debug("Drawing area ",udec(xtop), udec(ytop), udec(xbot), udec(ybot), uhex(bg_color))
graphics.fill_rectangle(xtop,ytop,xbot,ybot,bg_color)