/* save the pen */ wg=malloc(imagesize(200,7,206,16));, w# R# u" W; \! G, p, O
rg=malloc(imagesize(240,7,246,16));
$ \& Z: W6 ` n vg=malloc(imagesize(280,7,286,16));
1 U) W: v' j3 {( Q0 X( L1 W; M8 y# s fy=malloc(imagesize(200,7,206,16));
4 I0 [- Q' u* V& v9 b9 _' E0 ~ getimage(200,7,206,16,wg);
: [- f0 O4 f4 l9 W getimage(240,7,246,16,rg);- a+ x7 X/ @+ g6 t6 E' r
getimage(280,7,286,16,vg);
6 f' m) N# e/ {$ M' s" Y cleardevice();
$ K- B0 V5 @! f /* write the box */
% c9 O& ]0 A: O( @ setcolor(YELLOW);
5 K! U3 q1 t) w# p rectangle(4,19,637,447);& l. L7 V G ~3 \$ N
x1=x-3;
. E3 X2 q# Y& U, k3 B, q& d; `$ @5 u3 F y1=y+1;. K% t; F8 t# D+ |! h
x2=x+3;
/ D" L8 c" }5 B8 I; Z2 y5 u y2=y+10;$ s3 H: e, E6 S! s; G! y- y
getimage(x1,y1,x2,y2,fy);
% ]; `$ a" ]/ H putimage(x1,y1,vg,XOR_PUT);1 F% x, h' _4 c% ?8 |0 k
/* receive the command */
' H& s5 _1 I& [3 m3 T5 o7 m9 f for (;;)0 f' K5 u3 a2 d6 f1 Y
while (bioskey(1)==0);
" P4 H7 h2 l: v R+ L k=bioskey(0);$ C) J( A, {5 s4 w/ }8 g3 c! u
putimage(x1,y1,fy,AND_PUT);" f+ ? ~+ G: V$ o
if (((k&0x00ff)|0x00)==0)+ R- K& ~" `2 M) T
k1=k&0xff?0:k>>8; /* k1 is the specialkey value */, Z/ _+ g1 C; r2 V3 F/ o8 z
else
6 t4 S7 I f, B* ?1 @" u7 r k2=k&0x00ff; /* k2 is the non-specialkey value */# E1 U9 [! R+ |0 ^) W! i
if (((k&0x00ff)|0x00)==0) /* Special key */: q6 j2 S+ a m& V! S, X# ]
switch(k1)9 y# P) C2 W* \, l, R% A+ H
case 45:( c K, E/ v$ {! r0 S& P/ b
restorecrtmode();
* Y& j& Y) q0 u# H5 V0 o7 i- N exit(0);
# H1 h7 {3 ~5 F case 72:+ i* ` l" [/ `1 F" u/ F- h& n
if (y>20)% l5 X% r6 v# O0 x$ M1 r: t
y=y-1;: z9 I' q. u. F; N; M0 S# w' u
break;- L9 C; o7 D; m! V; V4 h* T
case 75:
. l% K. c* A. Z if (x>5)
& u- M2 a( D4 Z3 @9 B x=x-1;. Y& l( T0 n1 p( U
break;! Q) q: i. ] C f6 b5 V" z
case 77:6 i$ t5 q$ ~) E' e9 E3 D
5 U& `4 ]0 q6 r# ]! ]$ c if (x |