Você está na página 1de 10

GP142: The 142 Graphics Package User's Guide

This document describes GP142, the Graphics Package for CSE/ENG 142 at the !" #$ersion
2%2&, 'u() 1**+,% -t pro$ides simp(e graphica( output #dra.ing (ines, rectang(es, etc%,, simp(e
animation, and simp(e user input #mouse c(icks and ke)board input,% -t is taken $erbatim from
the !" .eb site #...%cs%.ashington%edu, apart from a fe. minor changes here and there%
Contents/
0ra.ing 1ode(
2(o. of Contro( and !ser -nteraction
Periodic !pdate E$ents and 3nimation
The un 1enu
1isce((aneous
4ist of 2unctions
GP142 0emo Program
Drawing Model
The unit of a computer graphics s)stems is the pixel #short for 5picture e(ement5,, .hich is the
sma((est dot that can be dra.n% 'ust to gi$e )ou some sense of sca(e, there are about +&67& pi8e(s
per inch on t)pica( computer screens% GP142 does a(( of the dra.ing in a sma(( .indo. of
appro8imate() 9&& b) 2:& pi8e(s ca((ed the 5graphics .indo.5, sho.n be(o.% Positions in this
.indo. are described b) the usua( #8,), coordinate s)stem, .ith its origin appro8imate()
centered in the .indo.% Si;e of the .indo. is gi$en b) the constants GP142_XMAX and
GP142_YMAX set here to <&& and 2:&%
3 t)pica( dra.ing command is the one to dra. a (ine/
GP142_lineXY(RED, -10, 50, 60, 50, 5);
.hich .i(( dra. a hori;onta( red (ine : pi8e(s .ide and appro8imate() +& pi8e(s (ong, from the
point #61&,:&, to the point #9&,:&,% To be some.hat more precise, )ou can imagine the (ine being
dra.n b) a red marker pen .ith a : pi8e( .ide tip% The pen starts .ith its tip centered at #61&,:&,
and is dragged to #9&,:&,% Note that the dra.n (ine .i(( o$erhang the start and end point b) 2 or <
pi8e(s in each direction due to the .idth of the pen tip%
3s another e8amp(e of the basic dra.ing routines, GP142_rectangleXY .i(( dra. a rectang(e,
again using the mode( of dragging a marker pen of designated thickness around the perimeter of
the designated rectang(e% =ther functions dra. triang(es and o$a(s #e((ipses,% 2or these c(osed
figures #i%e%, rectang(es, triang(es, and o$a(s, a (ine thickness of & specifies that the figure shou(d
be fi((ed, rather than out(ined, .ith the designated co(or% 2or e8amp(e,
GP142_rectangleXY(!"E, -10, -5, 10, 5, 0)
.i(( dra. a 2& b) 1& pi8e( so(id b(ue rectang(e in the center of the .indo.%
1ost of the GP142 dra.ing routines come t.o f(a$ors% =ne uses > and ? coordinates to
describe points in the graphics .indo., and the other uses the struct GP142@point #.hich is
Adefined in gp142%h,% "e ha$enBt )et co$ered structs in (ecture, donBt .orr)% 'ust use the >?
$ersions66 the functiona(it) is the same% The t)pe GP142_#$int is defined as fo((o.s/
t%#e&e' (tr)ct *
int +;
int %;
, GP142_#$int;
Consider the e8amp(e abo$e .hich dre. a 2&81& pi8e( b(ue rectang(e in the center of the screen%
!sing the >? function, this .as done (ike this/
GP142_rectangleXY(!"E, -10, -5, 10, 5, 0)
The e8act same shape can be dra.n using the point functions (ike this/
GP142_#$int l$-er_le't . *-10, 5,; /0 Declare an& init t1e c$rner( 0/
GP142_#$int )##er_rig1t . *10, 5,;
222
GP142_rectangleP(!"E, l$-er_le't, )##er_rig1t, 0);
Cere is another e8amp(e sho.ing ho. )ou might use either the >? or the point functions to do
the same thing% 3 ca(( to/
GP142_circleXY(!"E, -10, -5, 10)
dra.s a b(ue, fi((ed circ(e of radius 1& centered at 61&,6:, .hich is s(ight() be(o. and to the (eft
of the center of the graphics .indo.% ?ou can dec(are and initia(i;e a $ariab(e ($3e_#$int to do
e8act() the same/
GP142_#$int ($3e_#$int; /0 4e5ll (e#arate &eclarati$n an& 0/
/0 initiali6ati$n t1i( ti3e2 0/
222
($3e_#$int2+ . -10; /0 7et )# t1e center $' t1e circle2 0/
($3e_#$int2% . -5;
GP142_circleP(!"E, ($3e_#$int, 10)
%
?ou can put disp(a) te8t in the graphics .indo. .ith GP142_#rint'XY%
GP142_#rint'XY(c, +, %, (, 8'$r3at-(tring8, e+#re((i$n1, e+#re((i$n2, 222)
is much (ike #rint'(8'$r3at-(tring8, e+#re((i$n1, e+#re((i$n2,222), e8cept that the
resu(ting string of characters is 5printed5 in the graphics .indo., starting at position #8,), in
co(or c and 5point si;e5 s% The point si;e of te8t is rough() the .idth in pi8e(s of a t)pica(
character% Point si;es of nine to t.e($e are good si;es for (abe(ing things in )our figures%
#=rdinar) #rint' .orks, too, but its output goes to the conso(e .indo., not the graphics
.indo.%, 4ike ordinar) #rint', GP142_#rint'XY mo$es to a ne. (ine .hen )ou put a ne.(ine
character #5Dn5, in the format string%
2or e8amp(e,
GP142_#rint'XY(RED, 0, 50, 10, 89& 9' 9c8, 10, 1121, 5A5);
prints 10 1121 A in red at position #&,:&, using a medium si;ed font #1& point,%
3 more comp(ete (ist of a$ai(ab(e functions is gi$en be(o.%
Flow of on!rol and User "n!erac!ion
'ust as )ou cannot use CBs standard -/= faci(ities .ithout ha$ing :incl)&e ;(t&i$21<, )ou
cannot use GP142 .ithout :incl)&e 8GP142218% The protot)pe for each of the functions is
defined there% #Note/ use 8GP142218, not ;GP14221<%,
Eefore )ou can use an) of the GP142 functions, )ou must ca(( GP142_$#en() to a((o. the
package to do $arious initia(i;ations, such as opening the graphics .indo.% Simi(ar(), before
)our program Fuits, it shou(d ca(( GP142_cl$(e() to a((o. the package to do certain c(eanup
operations% -n bet.een, )ou can do an) desired series of dra.ing commands% -f )our program is
5noninteracti$e5 and not animated, thatBs a(( there is to it%
To .rite interacti$e programs, i%e%, ones .here the programBs beha$ior depends on user actions
(ike c(icking the mouse, or to do animation, there is one other important feature of the package 66
the notion of 5e$ents5% The function ca(( GP142_a-ait_e=ent does Gust .hat its name suggests/
it .aits for some interesting 5e$ent5 to occur before returning to )our program% The four kinds of
e$ents it .aits for are mouse c(icks, ke)strokes on the ke)board, 5periodic update5 e$ents
#e8p(ained be(o.,, and the Fuit signa(% GP142_a-ait_e=ent returns a code indicating .hich kind
of e$ent occurred% 3(so, if the e$ent .as a mouse c(ick, it returns the x and y coordinates of the
mouse pointer% Simi(ar(), for a ke)board e$ent, it returns the character corresponding to the ke)
pressed%
So, in out(ine, a t)pica( interacti$e program using GP142 .i((/
Ca(( GP142_$#en()%
Ca(( $arious of the GP142 dra.ing commands to set up the static part of the picture%
Ca$e a (oop ca((ing GP142_a-ait_e=ent repeated(), unti( a Fuit e$ent is signa(ed% -nside
the (oop the other three kinds of e$ents are hand(ed% #3 s.itch statement might be a
hand) .a) to do this%,
Ca(( GP142_cl$(e()%
-n some.hat more detai(, the fo((o.ing is basica(() the entire main program from the GP142
demo program #see u.demo%c on the C dri$e,%
:incl)&e ;(t&i$21<
:incl)&e 8GP142218
:&e'ine >A!7E 0
:&e'ine ?R"E 1
int 3ain(=$i&)
*
int @)it; /0 1a( )(er (ignale& @)it %etA 0/
int 3$)(e_+, 3$)(e_%; /0 3$)(e c$$r&inate( 'r$3 GP142_a-ait_e=ent 0/
c1ar Be%_#re((e&; /0 c1aracter 'r$3 GP142_a-ait_e=ent 0/
GP142_$#en(); /0 C#en an& initiali6e t1e Gra#1ic( 4in&$- 0/
/0
0 41ate=er initiali6ati$n %$) -ant g$e( 1ere2 >$r e+a3#le, %$)
0 3ig1t -ant t$ &ra- %$)r na3e, (t)&ent n)3Der, an& (ecti$n $n
0 t1e (creen, t$get1er -it1 $t1er (tatic #art( $' %$)r #ict)re2
0/
/0
0 ?1e 3ain e=ent l$$#E
0 --- ---- ----- -----
0 4ait '$r t1e ne+t )(er acti$n (3$)(e clicB, Be%(tr$Be, $r a
0 #eri$&ic )#&ate e=ent) an& call t1e a##r$#riate ')ncti$n t$
0 1an&le it2 Re#eat t1i( )ntil )(er (ignal( 8@)it82
0/

@)it . >A!7E;
-1ile (F@)it) *

(-itc1 (GP142_a-ait_e=ent(G3$)(e_+, G3$)(e_%, GBe%_#re((e&)) *
ca(e GP142_H"I?E
@)it . ?R"E; /0 (et 'lag t$ ter3inate l$$# 0/
DreaB;

ca(e GP142_MC"7EE
&e3$_1an&le_3$)(e(3$)(e_+,3$)(e_%);
DreaB;

ca(e GP142_JDE
&e3$_1an&le_BD&(Be%_#re((e&);
DreaB;

ca(e GP142_PERICDIKE
&e3$_1an&le_#eri$&ic();
DreaB;
&e'a)ltE
DreaB;
,
,
GP142_cl$(e(); /0 Klean )# an& cl$(e gra#1ic( -in&$- 0/

ret)rn(0);
,
Periodic Upda!e #$en!s and %ni&a!ion
!n(ike ke)board, mouse, and Fuit e$ents, the 5periodic update5 e$ents are not signa(ed b) an)
e8p(icit user action% ather, the) are something (ike c(ock ticks% The) are signa(ed appro8imate()
1&62& times per second, a(though not .ith c(ock.ork regu(arit)% The) are intended to a((o. )ou
to do simp(e animations/ e$er) time a periodic update e$ent is signa(ed, )our program cou(d
update the disp(a) to sho. the ne8t 5frame5 of an animation seFuence% 2or e8amp(e, the u.
demo program #among other things, disp(a)s something (ike a c(ock, erasing and redra.ing the
c(ock hand a fe. degrees for.ard .ith e$er) periodic update e$ent%
?ou might .onder .h) .e do not do animation b) Gust e8p(icit() .riting a (oop that dra.s
frame after frame% 2or one thing, that .ou(d (ike() go faster than the e)e cou(d fo((o.% 1ore
serious(), it .ou(d pre$ent other user interaction, (ike ke)board and mouse actions, from being
noticed b) the program, and pre$ent $arious usefu( 5background5 tasks from being performed b)
the computer%
The 'un Menu
GP142 pro$ides a menu ca((ed 5un5, .ith the fo((o.ing items/
1% %ni&a!e: 3ctua((), the discussion in the pre$ious section is o$ersimp(ified% Periodic
update e$ents are signa(ed on() af!er )ou choose 53nimate5 from the un menu%
2% (al! %ni&a!ion: Stop signa((ing periodic update e$ents%
<% %d$ance one fra&e: Se(ecting this menu item signa(s Gust one periodic update% This is
$er) usefu( for debugging )our animations, since it (ets )ou step through them frame b)
frame%
4% )ogging: Se(ecting 54ogging5 causes a(( GP142 function ca((s to be (ogged to the
conso(e .indo.% This can be he(pfu( during debugging% Se(ecting it again turns off
(ogging% Note that the graphics .indo. runs Fuite s(o.() .ith (ogging turned on, so for
animations )ou .i(( .ant it turned off once )ou ha$e finished debugging% 3(so, .ith
(ogging on, the machine gets Fuite s(uggish at recogni;ing mouse c(icks, so it is hard #but
not impossib(e, to pu(( do.n the menu to turn (ogging off again% The so(ution is to use the
(ogging ke)board shortcut K?R! L ! instead of the mouse to turn it off%
:% 'ecord GP142*+': ecord subseFuent e$ents in a fi(e named GP142%SC% ?ou shou(d
a$oid ha$ing a fi(e .ith this name #un(ess )ou .ant it o$er.ritten,%
9% Pla,-ack GP142*+': P(a)back the seFuence of e$ents recorded in GP142%SC%
+% Pla,-ack .ne #$en!: P(a)back Gust the ne8t e$ent in GP142%SC%
7% /ui!: signa(s the Fuit e$ent #as does c(icking the 5c(ose bo85 in the upper (eft corner of
the graphics .indo.,% Note that these actions do not force )our program to FuitH the)
mere() signa( the e$ent that reFuests it to Fuit% -t is up to )ou to make )our program
respond appropriate()%
GP142Bs $ersion number is a(so disp(a)ed on the menu, in case )ou need to kno.%
Flushing and learing !he 0indow
"hen )ou e8ecute a dra. command, the screen is not instantaneous() redra.n% 1an) animation
reFuire hundreds of obGects to be dra.n e$er) second% -f a(( these obGect are dra.n immediate(),
the screen .i(( continuous() f(icker and (ook rea(() bad% To a$oid this, GP142 does .hat is ca((ed
double buffering%
0oub(e buffering dra.s a(( the obGects offscreen .here )ou canBt see them% Then, .hen
GP142_a-ait_e=ent() is ca((ed, this offscreen buffer is copied onto the .indo. a(( at once%
This a((o.s the dra.ing to appear smooth%
"hat this means for )ou is that )ou .onBt see an obGect appear on the screen unti( )ou ca((
GP142_a-ait_e=ent()% Sometimes, (ike .hen )ouBre debugging, )ou .ant to see an obGect
dra.n immediate()% -n this case, )ou can use the GP142_'l)(1() function to force the screen to
be redra.n%
"hen )ou .ant to erase the screen, )ou can use GP142_clear() to c(ear the entire .indo.,
a((o.ing )ou to redra. e$er)thing from scratch%
Miscellaneous
The function ca((s GP142_l$gging and GP142_ani3ate (et )ou simu(ate the ana(ogous menu
items under program contro(%
Note that )ou canno! use scanf in a GP142 program% Co.e$er, ke)board e$ents a((o. )ou to get
indi$idua( characters t)ped b) the user% #There is a(so a function GP142_get( that a((o.s )ou to
prompt for and get a string t)ped b) the user, but use of this faci(it) reFuires an understanding of
C strings,%
2or comp(eteness .e shou(d a(so mention the difference bet.een functions .ith name
GP142_222XY and those .ith name GP142_222P% The XY suffi8 on man) of the function names is
there to remind )ou that the) take pairs of integer parameters to specif) the #8,), coordinates of
points% There is an eFui$a(ent set of functions .ith a P suffi8, that pass points b) using a Point
t)pe defined as a (tr)ct% !se of these functions reFuires an understanding of C structs, so
ignore the GP142_222P functions unti( then%
)is! of Func!ions
The protot)pe for each of the graphics functions is defined in the fi(e GP142%h, and summari;ed
be(o.% #"hat appears here is not taken from GP142%h $erbatim, but is a s(ight() 5saniti;ed5
$ersion% -f )ou are interested in the e8act detai(s, consu(t the GP142%h fi(e itse(f%,
3(so do not .orr) about some of the code ke).ords #(ike 23I,
/0 c$l$r #allet 0/
:&e'ine MAX_KC!CR7 24
:&e'ine !AKJ 0
:&e'ine 4MI?E 1
:&e'ine RED 2
:&e'ine GREEN O
:&e'ine !"E 4
:&e'ine YE!!C4 5
:&e'ine MAGEN?A 6
:&e'ine KYAN P
:&e'ine P"RP!E Q
:&e'ine NARY_!"E S
:&e'ine D"7?Y_P!"M 10
:&e'ine IKE_!"E 11
:&e'ine ?"RH"CI7E 12
:&e'ine CRANGE 1O
:&e'ine RC4N 14
:&e'ine PINJ 15
:&e'ine KMA!J 16
:&e'ine GC!D 1P
:&e'ine PEAKM 1Q
:&e'ine >CRE7?_GREEN 1S
:&e'ine 7EA_GREEN 20
:&e'ine C!IRE 21
:&e'ine MED_GRAY 22
:&e'ine !?_GRAY 2O
=$i& GP142_$#en(=$i&); /0 Initiali6e t1e GP142 liDrar%2 0/
/0 In=$Be t1i( at t1e Deginning $' 3ain() 0/
=$i& GP142_cl$(e(=$i&); /0 Kl$(e t1e liDrar%2 0/
/0 In=$Be t1i( at t1e en& $' 3ain() 0/
=$i& GP142_#i+elXY( /0 Dra- a #i+el $n t1e gra#1ic( -in&$-2 0/
int, /0 c$l$r 0/
int, int); /0 +, % c$$r&inate( 0/
=$i& GP142_lineXY( /0 Dra- a line (eg3ent $n t1e gra#1ic( -in&$-2 0/
int, /0 c$l$r 0/
int, int, /0 +, % c$$r&inate( $' (tarting #$int 0/
int, int, /0 +, % c$$r&inate( $' en&ing #$int 0/
int); /0 line -i&t1 0/
=$i& GP142_rectangleXY( /0 Dra- a rectangle $n t1e gra#1ic( -in&$-2 0/
int, /0 c$l$r 0/
int, int, /0 +, % c$$r&inate( $' an% c$rner 0/
int, int, /0 +, % c$$r&inate( $' $##$(ite c$rner 0/
int); /0 line -i&t1 0/

=$i& GP142_triangleXY( /0 Dra- a triangle $n t1e gra#1ic( -in&$-2 0/
int, /0 c$l$r 0/
int, int, /0 +, % c$$r&inate( $' 'ir(t c$rner #$int 0/
int, int, /0 +, % c$$r&inate( $' (ec$n& c$rner #$int 0/
int, int, /0 +, % c$$r&inate( $' t1ir& c$rner #$int 0/
int); /0 line -i&t1 0/

=$i& GP142_$=alXY( /0 Dra- an $=al $n t1e gra#1ic( -in&$-2 0/
int, /0 c$l$r 0/
int, int, /0 +, % c$$r&inate( $' an% (D$)n&ing D$+) c$rner
0/
int, int, /0 +, % c$$r&inate( $' $##$(ite c$rner 0/
int); /0 line -i&t1 0/
=$i& GP142_circleXY( /0 Dra- a 'ille& circle $n t1e gra#1ic( -in&$-2 0/
int, /0 c$l$r 0/
int, int, /0 +, % c$$r&inate( $' center 0/
int); /0 ra&i)( 0/

/0
0 GP142_#rint'XY #r$=i&e( '$r3ate& #rint$)t t$ t1e gra#1ic( -in&$-,
0 e((entiall% liBe #rint'2 Ne-line( &$ a&=ance te+t t$ t1e ne+t line2
0
0 >$r e+a3#le, t1e call
0 GP142_#rint'XY(RED, 0, 20, 10, 89c9c9c 9&8, 5K5, 575, 5E5, 142);
0 #rint( t1e (tring K7E 142 in re& (tarting at #$(iti$n (0, 20) )(ing
0 10 #$int t%#e2
0/
=$i& GP142_#rint'XY(
int c$l$r, /0 te+t c$l$r 0/
int +, int %, /0 +, % c$$r&( $' le't en& $' te+t 0/
int #$int_(i6e, /0 te+t (i6e 0/
c1ar '3tTU, /0 t1e #rint' '$r3at (tring 0/
t%#e1 e+#r1,
t%#e2 e+#r2, 222 ); /0 li(t $' =al)e( t$ #rint 0/
=$i& GP142_clear(=$i&); /0 Klear gra#1ic( -in&$-2 0/
e+tern int >AR
GP142_'l)(1(=$i&); /0 'l)(1e( t1e -in&$- D% e+ec)ting all &ra-ing
re@)e(t( t1at 1a=e Deen i(()e&2 ?1e (creen i( 'l)(1e&
-1en GP142_a-ait_e=ent i( calle&, ($ %$) &$n5t nee&
t$ )(e t1i( ')ncti$n )nle(( %$) -ant t$ (%nc1r$ni6e
%$)r &i(#la% (#er1a#( -1en &eD)gging) 0/
int GP142_a-ait_e=ent( /0 >etc1 t1e ne+t e=ent2 0/
int 0, /0 #$inter t$ 3$)(e5( + c$$r&inate 0/
int 0, /0 #$inter t$ 3$)(e5( % c$$r&inate 0/
c1ar 0); /0 #$inter t$ c1aracter V)(t entere& 0/
e+tern int >AR
GP142_get(( /0 Di(#la% a &ial$g D$+, an& a(B )(er 0/
/0 '$r a (tring 0/
c$n(t c1ar #r$3#tTU, /0 Pr$3#t (tring 0/
c1ar re()ltTU); /0 Re()lt (tring 0/
e+tern =$i& >AR /0 1a( an e''ect in 4in&$-( $nl% 0/
GP142_(1$-_te+t( /0 (1$- $r 1i&e t1e te+t -in&$- 0/
int (1$-it); /0 n$n6er$ . (1$-, 6er$ . 1i&e 0/
/0 P$((iDle ret)rn( =al)e(E 0/
:&e'ine GP142_MC"7E 1
:&e'ine GP142_JD 2
:&e'ine GP142_PERICDIK O
:&e'ine GP142_H"I? 4
=$i& GP142_l$gging( /0 7-itc1 l$gging $n $r $''2 0/
int); /0 P$((iDle =al)e(E 0/
:&e'ine !CG_C>> 0 /0 .. n$ l$gging 0/
:&e'ine !CG_CN 1 /0 .. l$gging 0/

=$i& GP142_ani3ate( /0 K$ntr$l( 'l$- $' #r$gra32 0/
int); /0 P$((iDle =al)e(E 0/
:&e'ine ANI_MA!? 0 /0 .. 7t$# ani3ati$n 0/
:&e'ine ANI_7ING!E_7?EP 1 /0 .. A&=ance $ne 'ra3e 0/
:&e'ine ANI_R"N 2 /0 .. 7tart ani3ati$n 0/
:&e'ine ANI_H"I? 5 /0 .. H)it #r$gra3 0/
/0
0 P$int =er(i$n( $' 3an% $' t1e aD$=e ')ncti$n(
0/
t%#e&e' (tr)ct *
int +;
int %;
, GP142_#$int;
t%#e&e' (tr)ct *
int +, %;
c1ar c;
, GP142_e=ent_t;
e+tern int >AR
GP142_a-ait_e=entP( /0 >etc1 t1e ne+t e=ent 0/
GP142_e=ent_t 0e=ent); /0 #$inter t$ e=ent rec$r& 0/
e+tern int >AR
GP142_#i+elP( /0 &ra- a #i+el in t1e gra#1ic( -in&$- 0/
int c$l$r, /0 c$l$r 0/
GP142_#$int #); /0 P$int t$ &ra- 0/
e+tern int >AR
GP142_lineP( /0 &ra- a line (eg3ent $n t1e gra#1ic( -in&$-
0/
int c$l$r, /0 c$l$r 0/
GP142_#$int #1, /0 (tarting #$int 0/
GP142_#$int #2, /0 en&ing #$int 0/
int t1icBne((); /0 line -i&t1 0/
e+tern int >AR
GP142_rectangleP( /0 &ra- a rectangle $n t1e gra#1ic( -in&$- 0/
int c$l$r, /0 c$l$r 0/
GP142_#$int #1, /0 $ne c$rner #$int 0/
GP142_#$int #2, /0 $##$(ite c$rner #$int 0/
int t1icBne((); /0 line -i&t1; 0 .< 'ill 0/
e+tern int >AR
GP142_triangleP( /0 &ra- a triangle $n t1e gra#1ic( -in&$- 0/
int c$l$r, /0 c$l$r 0/
GP142_#$int #1, /0 'ir(t c$rner #$int 0/
GP142_#$int #2, /0 (ec$n& c$rner #$int 0/
GP142_#$int #O, /0 t1ir& c$rner #$int 0/
int t1icBne((); /0 line -i&t1; 0 .< 'ill 0/
e+tern int >AR
GP142_$=alP( /0 &ra- an $=al $n t1e gra#1ic( -in&$- 0/
int c$l$r, /0 c$l$r 0/
GP142_#$int #1, /0 $ne c$rner #$int 0/
GP142_#$int #2, /0 $##$(ite c$rner #$int 0/
int t1icBne((); /0 line -i&t1; 0 .< 'ill 0/
e+tern int >AR
GP142_circleP( /0 &ra- a circle $n t1e gra#1ic( -in&$- 0/
int c$l$r, /0 c$l$r 0/
GP142_#$int #, /0 center #$int 0/
int ra&i)(); /0 ra&i)( 0/
e+tern int >AR
GP142_#rint'P( /0 #rint' $nt$ t1e gra#1ic( -in&$- 0/
int c$l$r, /0 te+t c$l$r 0/
GP142_#$int #, /0 +, % c$$r&( $' le't en& $' te+t 0/
int (i6e, /0 te+t (i6e 0/
c$n(t c1ar '3tTU, /0 t1e #rint' '$r3at (tring 0/
222 ); /0 li(t $' =al)e( t$ #rint 0/
GP142 De&o Progra&
Check the !" demo #u.demo%c on the C dri$e, program containing comp(ete source code for a
demonstration app(ication that shou(d gi$e )ou a good (ook at ho. to dra. rectang(es, o$a(s,
te8t, use printf, get mouse and ke)board e$ents, do animation, etc%

Você também pode gostar