2 <HEAD><TITLE>iiuwgraph</TITLE>
\r
5 <H1 align=center>unit IIUWGRAPH: class;</H1>
\r
6 <H2 align=center><IMG SRC="loglanmm.gif" ALT="LOGLAN's LOGO"></IMG>a predefined Loglan'82 class </H2>
\r
8 { this predefined class enables basic graphic operations
\r
9 for DOS machines based on <B>486</B> or 386 processors
\r
12 {this document gives the specification of new version of IIUWGRAPH
\r
14 made in October 1994 by <B><I>Frederic Pataud </I></B>à Pau}<P>
\r
16 <A NAME="Table of Contents"><B>Table of Contents</B></A>.<BR>
\r
19 <li> {IIUWGRAPH class}
\r
21 <li> {PROCEDURES of OVERALL CONTROL}
\r
23 <LI>unit <A HREF = "#GRON">GRON</A> : procedure (i: integer);
\r
24 <LI>unit <A HREF = "#GROFF">GROFF</A> : procedure;
\r
25 <LI>unit <A HREF = "#CLS">CLS</A> : procedure;
\r
26 <LI>unit <A HREF = "#COLOR">COLOR</A> : procedure(co : integer);
\r
27 <LI>unit <A HREF = "#STYLE">STYLE</A> : procedure(styl : integer);
\r
28 <LI>unit <A HREF = "#BORDER">BORDER</A> : procedure (background_Colour: integer);
\r
29 <LI>unit <A HREF = "#PALLET">PALLET</A> : procedure (nr : integer);
\r
31 <LI>{ PROCEDURES CONTROLLING POSITION }
\r
33 <LI>unit <A HREF = "#MOVE">MOVE</A> : procedure (x,y :integer);
\r
34 <LI>unit <A HREF = "#INXPOS">INXPOS</A> : function: integer;
\r
35 <LI>unit <A HREF = "#INYPOS">INYPOS</A> : function : integer;
\r
36 <LI>unit <A HREF = "#PUSHXY">PUSHXY</A> : procedure;
\r
37 <LI>unit <A HREF = "#POPXY">POPXY</A>: procedure;
\r
39 <LI>{ PROCEDURES SERVING POINTS and LINES}
\r
41 <LI>unit <A HREF = "#POINT">POINT</A> : procedure(x,y: integer);
\r
42 <LI>unit <A HREF = "#INPIX">INPIX</A> : function (x,y : integer) : integer;
\r
43 <LI>unit <A HREF = "#DRAW">DRAW</A> : procedure( x,y : integer);
\r
44 <LI>unit <A HREF = "#intens">intens</A>: procedure(Size :integer; xCoord,yCoord:arrayof integer,
\r
45 Colour,Filled :integer);
\r
46 <li>unit <a href="#CIRB">cirb </a> {draw a circle} procedure;
\r
47 <LI>unit <A HREF = "#HFILL">hfill</A>: procedure( x : integer);
\r
48 <LI>unit <A HREF = "#VFILL">vfill</A>: procedure( y : integer);
\r
49 <LI>unit <A HREF = "#PATERN">patern</A>: procedure( x1,y1,x2,y2,c,b : integer);
\r
51 <LI>{ Procedures operating on bitmaps }
\r
53 <LI>unit <A HREF = "#GETMAP">GETMAP </A> : function (x,y : integer) : arrayof integer;
\r
54 <LI>unit <A HREF = "#PUTMAP">PUTMAP </A> : procedure ( a: arrayof integer);
\r
55 <LI>unit <A HREF = "#ORMAP">ORMAP </A> : procedure ( a : arrayof integer);
\r
56 <LI>unit <A HREF = "#XORMAP">XORMAP </A> : procedure ( a: arrayof integer);
\r
58 <LI>{Procedures operating on characters and strings}
\r
60 <LI>unit <A HREF = "#outstring">outstring</A>: procedure(x,y: integer, s: string, back_col, front_col:
\r
62 <LI>unit <A HREF = "#track">track</A>: procedure( x,y,c,valeur : integer);
\r
63 <LI>unit <A HREF = "#inkey">inkey </A> : function : integer;
\r
64 <LI>unit <A HREF = "#HASCII">HASCII </A> : procedure(c: integer);
\r
65 <LI>unit <A HREF = "#hfont">hfont</A>: function( x,y,lg,min,max,default,col_f,col_e,col_c : integer):
\r
67 <LI>unit <A HREF = "#HPAGE">HPAGE </A> : procedure(x,y,long: integer, A: arrayof char, back, front:
\r
72 <LI>unit <A HREF = "#MOUSE">MOUSE</A>: class;
\r
74 <LI>unit <A HREF = "#init">init</A>: procedure(checkMouse, checkKeyboard: integer);
\r
75 <LI>unit <A HREF = "#getmovement">getmovement</A>: procedure(checkMouse, checkKeyboard:
\r
77 <LI>unit <A HREF = "#getpress">getpress</A>: function(v,p,h,l,r,c : integer): Boolean;
\r
78 <LI>unit <A HREF = "#showcursor">showcursor</A>: procedure;
\r
79 <LI>unit <A HREF = "#hidecursor">hidecursor</A>: procedure;
\r
81 <LI> a sample<A HREF = "#sample program"> program</A>
\r
88 { the early versions of library IIUWGRAPH have been elaborated by
\r
89 Piotr Carlsson, Miroslawa Milkowska, Janina Jankowska,
\r
90 Michal Jankowski at Institute of Informatics,
\r
91 University of Warsaw 1987,<P>
\r
92 and added to Loglan system by Danuta Szczepanska 1987, <P>
\r
94 the recent versions were done at LITA, Pau,<P>
\r
96 Pawel Susicki (1991) for Unix,<P>
\r
97 Sebastien Bernard (1992) for ATARI, see a separate document,<BR>
\r
98 Eric Becourt et Jerôme Larrieu (1993) for Unix and Xwindows, see a
\r
99 separate document on Xiiuwgraf ,
\r
103 fait à Pau, le 15 Novembre 1994, par Andrzej Salwicki, LITA}<P>
\r
105 { the predefined class IIUWGRAPH is included in all versions of interpreter of
\r
106 Loglan, with the <I>exception</I> of the present version of interpreter for
\r
111 <b>unit</b> IIUWGRAPH: <b>class</b>;
\r
112 <B> hidden</B> MaxX, MaxY, current_X, current_Y, is_graphic_On,
\r
113 current_Colour, current_Background_Colour, current_Style,
\r
114 current_Palette, current_Pattern ;
\r
118 <B> const</B> MaxX =
\r
121 { the screen's coordinates are
\r
123 (0,0) ----------------------> (MaxX,0)
\r
128 (0, MaxY) (MaxX,MaxY)
\r
133 <B> var</B> currentDriver : integer, { see NOCARD below }
\r
134 current_X, current_Y: integer { it is the current position }
\r
135 is_graphic_On: Boolean, { evidently tells whether we are in
\r
137 current_Colour : integer, { }
\r
138 current_Background_Colour : integer,
\r
139 current_Style : integer, { }
\r
140 current_Palette : integer,
\r
144 <H2><B>unit </B> <A
\r
145 NAME="GRON"> GRON </A> <B> procedure </B>
\r
147 { procedure sets the monitor in graphic mode and clears the buffer
\r
148 of screen. The parameter determines the resolution and the number of
\r
150 The user should assure that the resolution chosen should correspond to that
\r
151 which is set by means of command <BR>
\r
152 SET go32 drivers {path}< driver.file> < width> < height> <
\r
155 set go32 drivers c:\loglan\svga\drivers\vesa.grn gw 1024 gh 480 nc 256<BR>
\r
156 <P> An execution of instruction call gron(i) <B><I>must precede</I>
\r
157 </B> any of the graphic commands described below.<P>
\r
173 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
175 <H2><B>unit</B> <A
\r
176 NAME="GROFF"> GROFF </A><B> procedure</B
\r
178 { the procedure sets the monitor in the text mode filling it with
\r
180 DO NOT FORGET to set the monitor in the text mode before
\r
181 you terminate your program<P>
\r
183 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
186 <H2><B>unit</B> <A NAME="CLS"> CLS </A> .
\r
187 : <B> procedure</B>;</H2>
\r
188 { the screen will be cleared and filled with colour 0 }<P>
\r
189 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
193 { PROCEDURES CONTROLLING THE COLOURS }<P>
\r
195 <H2><B>unit </B> <A
\r
196 NAME="COLOR"> COLOR </A> . :
\r
197 <B> procedure</B>(co : integer);</H2>
\r
198 { sets current color to co <BR>
\r
199 for monochrome displays, 0 means black, non-0 - white<BR>
\r
200 for color displays, 0 means background<BR>
\r
203 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
205 <H2><B>unit </B> <A
\r
206 NAME="STYLE"> STYLE </A> :
\r
207 <B> procedure</B>(styl : integer);</H2>
\r
208 { sets style of lines and fill shades to a combination<P>
\r
209 of current color and background color (for mono -<P>
\r
210 white and black, respectively) according to 5 predefined<P>
\r
220 where '*' means current color, '.' background colour<P>
\r
221 When drawing the segments the subsequent pixels will have colour determined
\r
222 by cyclic application of style pattern. The first and the last pixels of a segment
\r
223 will have always current colour.<P>
\r
224 When filling contours the given style will be applied to horizontal lines with even
\r
225 coordinate. The style for odd lines is determined automatically.<P>
\r
226 The same applies for perpendicular lines.<P>
\r
229 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
231 <H2><B>unit </B> <A
\r
232 NAME="BORDER"> BORDER </A> . :
\r
233 <B>procedure</B> (background_Colour:
\r
236 <P> { sets actual background color to i ( i = 0,1,...,15 ) }<P>
\r
238 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
240 <H2><B>unit </B> <A
\r
241 NAME="PALLET"> PALLET </A> :
\r
242 <B>procedure</B> (nr : integer);</H2>
\r
243 {the following line makes an example, it is not valid for, say,
\r
246 the codes of colors are <I>usually i.e. when you have 16 colours,</I> as follows<P>
\r
250 3 turquoise dark<P>
\r
265 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
269 <H2>{ PROCEDURES CONTROLLING POSITION }</H2>
\r
271 <H2><B>unit </B> <A
\r
272 NAME="MOVE">MOVE</A> :
\r
273 <B>procedure</B> (x,y :integer);</H2>
\r
274 { procedure MOVE sets the current position on the screen on the pixel
\r
275 with coordinates<P>
\r
278 { precondition of MOVE:<P>
\r
279 0*x*MaxX & 0*y*MaxY <P>
\r
281 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
283 <H2><B>unit </B> <A
\r
284 NAME="INXPOS">INXPOS</A> :
\r
285 <B>function</B>: integer;</H2>
\r
286 { function INXPOS returns the x coordinate of the current position }<P>
\r
287 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
290 <H2><B>unit </B> <A
\r
291 NAME="INYPOS">INYPOS</A> :
\r
292 <B>function</B> : integer;</H2>
\r
293 { function INYPOS returns the y coordinate of the current position }<P>
\r
294 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
297 <H2><B>unit </B> <A
\r
298 NAME="PUSHXY">PUSHXY</A> :
\r
299 <B>procedure</B>;</H2>
\r
300 { pushes current position, color & style onto the stack.<P>
\r
301 The stack is kept internally, max depth is 16<P>
\r
304 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
306 <H2><B>unit </B><A
\r
307 NAME="POPXY">POPXY</A> :
\r
308 <B>procedure</B>;</H2>
\r
310 { restores position, color & style from internal stack }<P>
\r
313 <PRE>unit DIAGONAL : procedure;<P>
\r
314 var ix, iy : integer;<P>
\r
319 call DRAW(ix+10, iy+10);<P>
\r
324 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
327 <H2>{ PROCEDURES SERVING POINTS &
\r
330 <H2><B>unit </B> <A
\r
331 NAME="POINT">POINT</A> :
\r
332 <B>procedure</B>(x,y: integer);</H2>
\r
333 { moves current position to pixel (x,y) and sets it to the current color
\r
335 }<P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
338 <H2><B>unit </B> <A
\r
339 NAME="INPIX">INPIX</A> : <B>function</B>
\r
340 (x,y : integer) : integer;</H2>
\r
342 moves to pixel (x,y) and returns its color setting;<P>
\r
344 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
347 <H2><B>unit </B> <A
\r
348 NAME="DRAW">DRAW</A> :
\r
349 <B>procedure</B>( x,y : integer);</H2>
\r
351 draws a line from current screen position to (<I>x,y</I>);<P>
\r
352 sets current position to (<I>x,y</I>);<P>
\r
353 line is drawn in current color, with both terminal pixels<P>
\r
354 always turned white ( non-background) for non-black<P>
\r
355 ( non-background ) line color.<P>
\r
357 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
359 <H2><B>unit </B> <A
\r
360 NAME="intens">intens</A> :
\r
361 <B>procedure</B>(Size :integer;
\r
362 xCoord,yCoord:arrayof integer, Colour,Filled
\r
365 /* draw a polygon*/
\r
366 { draw a simple, closed polygon of Size points, the edges of the polygon go from
\r
367 (<I>xCoord[i], yCoord[i]</I>) to (<I>xCoord[i+1], yCoord[i+1]</I>) for i = 1, ..., Size-1
\r
368 The colour used will be <I>Colour</I>. The polygon will be filled iff <I>Filled</I><
\r
371 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
373 <H2><B>unit </B><A NAME="CIRB"> CIRB</A> : <B>procedure</B> (xi, yi, rx,ry : integer, alfa, beta : real,
\r
374 cbord, fill : integer);<P></H2>
\r
378 <P> draws a circle (or ellipse, depending on aspect value, see below),<P>
\r
379 optionally filling its interior; <P>
\r
380 does not preserve position;<P>
\r
381 (<I>xi,yi</I>) - are center coordinates,<P>
\r
382 <I>rx</I> - radius in pixels (horizontally),<BR>
\r
383 <I>ry</I> - radius in pixels (perpendicularly),<P>
\r
384 <I>alfa, beta</I> - starting & ending angles; if alfa=beta a full<P>
\r
385 circle is drawn; values should be given in radians;<P>
\r
386 <I>cbord</I> - border color,<P>
\r
387 <I>fill</I> - if fill < > 0, interior is filled in current style& color<P>
\r
389 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
391 <H2><B>unit </B> <A NAME="hfill">hfill</A> :
\r
392 <B>procedure</B>( x : integer);</H2>
\r
393 { draw an horizontal line between the current position and<P>
\r
394 (x,currentY) with the current color, after it change the current<P>
\r
395 position to (x, currentY)<P>
\r
397 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
399 <H2><B>unit </B><A NAME="vfill">vfill</A> :
\r
400 <B>procedure</B>( y : integer);</H2>
\r
401 { draw a vertical line between the current position and<P>
\r
402 (currentX,y) with the current color, after it change the current<P>
\r
403 position to (currentX,y)<P>
\r
405 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
407 <H2><B>unit </B> <A
\r
408 NAME="patern">patern</A> :
\r
409 <B>procedure</B>( x1,y1,x2,y2,c,b :
\r
411 { draw a <B><I>rectangle</I></B> between the points (<I>x1,y1</I>) and
\r
412 (<I>x2</I>,<I>y2</I>) with the<P>
\r
413 color <I>c</I> (the current color is not change). if <I>b</I>=0 then the box
\r
415 empty else it is filled.<P>
\r
417 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
419 <H2>{ Procedures operating on bitmaps }</H2>
\r
421 <H2><B>unit </B> <A
\r
422 NAME="GETMAP">GETMAP</A> :
\r
423 <B>function</B> (x,y : integer) : <B>arrayof</B>
\r
425 {saves rectangular area between current position as<P>
\r
426 top left corner and (ix,iy) as bottom right corner,<P>
\r
427 including border lines;<P>
\r
428 position remains unchanged.<P>
\r
429 array of integer should have <P>
\r
430 4+(rows**columns/8* *coeff)<P>
\r
431 bytes. The coefficient coeff is 1 for Hercules, 2 for CGA, 4 for EGA<P>
\r
433 ATTENTION: in DOS 286 environment a bigger size of the array may
\r
434 necessitate the use of <I>loglan</I> with<I> the option H+</I>, see also
\r
437 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
439 <H2><B>unit </B> <A
\r
440 NAME="PUTMAP">PUTMAP</A> :
\r
441 <B>procedure</B> ( a: <B>arrayof</B>
\r
443 {sets rectangular area of screen pixels to that saved<P>
\r
444 by "getmap" in "iarray";<P>
\r
445 same size is restored, with top left corner in current<P>
\r
447 position remains unchanged.<P>
\r
449 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
451 <H2><B>unit </B> <A
\r
452 NAME="ORMAP">ORMAP</A> :
\r
453 <B>procedure</B> ( a : <B>arrayof
\r
455 {same as putmap, but saved bitmap is or'ed into screen<P>
\r
456 rather than just set.<P>
\r
458 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
460 <H2><B>unit </B> <A NAME="XORMAP">XORMAP </A> :
\r
461 <B>procedure</B> ( a:
\r
462 <B>arrayof</B> integer);</H2>
\r
463 {same as putmap, but saved bitmap is xor'ed into screen<P>
\r
464 rather than just set.<P>
\r
466 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
469 <H2>{Procedures operating on characters and strings}</H2>
\r
471 <H2><B>unit </B> <A
\r
472 NAME="outstring">outstring</A> :
\r
473 <B>procedure</B>(x,y: integer, s: string, back_col,
\r
474 front_col: integer);</H2>
\r
475 { <I>x, y</I> are the coordinates where to put the string,<P>
\r
476 <I>s</I> is the string to be shown, in <I>front_col</I> colour letters on the
\r
477 <I>back_col</I> colour background<P>
\r
479 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
481 <H2><B>unit </B> <A NAME="track">track</A>
\r
482 : <B>procedure</B>( x,y,c,valeur : integer);
\r
484 { write an integer value <I>valeur</I> at the position (<I>x,y</I>) with the
\r
486 It does not change the current position nor the current color<P>
\r
488 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
490 <H2><B>unit </B> <A NAME="inkey ">inkey
\r
491 </A> : <B>function</B> : integer;</H2>
\r
493 { returns next character from keyboard buffer;<P>
\r
494 0 is returned if buffer is empty;<P>
\r
495 special keys are returned as negative numbers;<P>
\r
496 ALT-NUM method may be used for entering character codes<P>
\r
497 above 127 (this makes entering special keys 128-132<P>
\r
499 if a character is returned, it is also removed<P>
\r
500 from the buffer, so MS-DOS will not see it (CTRL-C!);<P>
\r
501 typeahead is allowed, echo is suppressed.<P>
\r
503 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
505 <H2><B>unit </B> <A NAME="HASCII
\r
506 ">HASCII </A> : <B>procedure</B>(c:
\r
508 {'xor's the character = chr(c) in a 8*8 box with top left corner<P>
\r
509 in the current position;<P>
\r
510 moves current position by (8,0);<P>
\r
511 call hascii(0)- sets complete box to black ( =background ),<P>
\r
512 with no change in position.<P>
\r
514 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
518 <H2><B>unit </B><A NAME="hfont">hfont</A>
\r
519 : <B>function</B>(
\r
520 x,y,lg,min,max,default,col_f,col_e,col_c : integer):
\r
523 { arrange a small 1 line window for <B><I>reading</I></B> an integer value
\r
525 the position of the window corner is (<I>x, y</I>),
\r
526 the length of the window is <I>lg</I> characters,
\r
527 the value v should be greater than <I>min</I> and smaller than <I>max</I>,
\r
528 the default value read is <I>default</I>,<P>
\r
529 the colour of the window is <I>col_f</I>,<BR>
\r
530 the colour of the digits is <I>col_e,</I><BR>
\r
531 the colour of cursor is <I>col_c</I><P>
\r
533 reads in graphic mode an integer in the window which begins at the (x,y)
\r
534 position, window is lg caracteres long. the maximum length of the<P>
\r
535 integer that is read is 10. there is a default value, a minimum value
\r
536 and a maximum value. the window is drawn with the col_f color, the
\r
537 cursor is in the col_c color and the integer is writing in the col_e<P>
\r
538 color. you can use 0..9,+,-,backspace,escape and return keys. }<P>
\r
539 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
542 <H2><B>unit </B> <A NAME="HPAGE">HPAGE </A> : <B>procedure</B>(x,y,long:
\r
543 integer, A: arrayof char, back, front: integer);</H2>
\r
544 { this procedure arranges a 1-line high window in position <I>x,y</I> of
\r
545 length <I>long</I> in which a portion of text <I>A</I> is shown in colour
\r
546 <I>front</I> on the background colour <I>back</I>. <P>
\r
547 Making use of keys controlling the cursor {left, right, PgUp, PgDn}<P>
\r
548 the user can scroll the text (horizontally) in the window. Pressing the
\r
549 Enter key terminates the procedure} <P>
\r
550 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
552 <P align=left><B>end</B> IIUWGRAPH;<P>
\r
557 <P><H2><B>unit </B> <A NAME="MOUSE">MOUSE</A> .:
\r
558 <B>class</B>; </H2>
\r
560 <H6>{ <I>init</I> -lors de l'initialisation de la souris, on peut définir les événements qui vont faire réagir la
\r
561 fonction getpress; le premier et le deuxième paramètre représentent respectivement la souris et le clavier, si une
\r
562 valeur non nulle est donnée comme paramètre alors getpress réagira à l'événement.<P>
\r
564 Une paire (1,1) va permettre de prendre en compte à la fois les événements de la souris et ceux du clavier;
\r
565 une paire (1,0) quand à elle ne prendra en compte que la souris. Pour une plus grande souplesse d'utilisation, il est
\r
566 possible lors du programme, après l'initalisation, de changer cette prise en compte, cela se fera par l'appel de la
\r
567 procedure <I>getmovement</I>, procédure ayant les mêmes paramètres (avec le même ordre) que la fonction
\r
570 Pour detecter les événements, on utilisa la fonction <I>getpress</I>, qui retourne un booléen indiquant la
\r
571 présence ou l'absence d'événement (respectivement les valeurs true et false). Il est bon de noter qu'ainsi définie la
\r
572 fonction getpress n'est pas bloquante. Les paramètres en retour sont soit nuls (pas d'événement) soit
\r
575 bool:=getpress(v,p,h,l,r,c : integer);<P>
\r
576 v = position en y de la souris<P>
\r
577 p = keyboard status (Touche control_left,control_right, alt, alt_gr, shift_left, shift_right)<P>
\r
578 h = position en x de la souris<P>
\r
579 l = touche clavier<P>
\r
581 c = boutons de la souris (0=aucun, 1=gauche, 2=droite, 3=gauche et droite)<P>
\r
582 Nb: le bouton central n'est pas géré.<P>
\r
584 NOTEZ BIEN! Lorsque les événements du clavier sont pris en compte dans le gestionnaire, <B>il</B> <B>ne faut
\r
585 pas </B>utiliser les fonctions d'entrées clavier readl, readln, hfont, hfont8, hpage, inkey,...) <I>sous peine de
\r
586 plantage de l'ordinateur</I>.<P>
\r
590 <H2> <B>unit </B> <A NAME="init">init</A>
\r
591 : <B>procedure</B>(checkMouse,
\r
592 checkKeyboard: integer); </H2>
\r
593 { initializes the Mouse driver.<P>
\r
594 tells which events will be checked:<P>
\r
595 if checkMouse < > 0 then the events of Mouse will be reported to getpress, see below otherwise
\r
597 if checkKeyboard < > 0 then the events of Keyboard will be reported to getpress, otherwise ignored<P>
\r
598 <B><I>Attention please!</I></B> While the events of the keyboard are taken under control by
\r
599 <I>init</I> or <I>getmovement</I><P>
\r
600 <B><I>do not use</I></B> the functions or procedures: read, readln, hfont, hfont8, hpage, inkey
\r
602 YOU RISK TO HANG YOUR SYSTEM!<P>
\r
604 <B>end</B> init <P>
\r
605 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
607 <H2><B> unit </B><A
\r
608 NAME="getmovement">getmovement</A> :
\r
609 <B>procedure</B>(checkMouse, checkKeyboard:
\r
611 tells which events will be checked:<P>
\r
612 if checkMouse < > 0 then the events of Mouse will be reported to getpress, see below otherwise
\r
614 if checkKeyboard < > 0 then the events of Keyboard will be reported to getpress, otherwise ignored<P>
\r
615 <B><I>Attention please!</I></B> While the events of the keyboard are taken under control by
\r
616 <I>init</I> or <I>getmovement</I><P>
\r
617 <B><I>do not use</I></B> the functions or procedures: read, readln, hfont, hfont8, hpage, inkey
\r
619 YOU RISK TO HANG YOUR SYSTEM!<P>
\r
620 <B>end</B> getmovement;<P>
\r
621 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
623 <H2><B> unit </B> <A
\r
624 NAME="getpress">getpress</A> :
\r
625 <B>function</B>(v,p,h,l,r,c : integer):
\r
627 { <I>v</I> = y coordinate of the cursor,<P>
\r
628 <I>h</I> = x coordinate of the cursor,<P>
\r
629 <I>p</I> = keybord status control_left,control_right, alt, alt_gr, shift_left, shift_right<P>
\r
630 <I>l</I> = code of key pressed<P>
\r
631 <I>r</I> = flags<P>
\r
632 <I>c</I> = buttons pressed (0=aucun, 1=gauche, 2=droite, 3=gauche et droite)<P>
\r
633 Nb: the middle button is not taken into account.<P>
\r
634 <B>end</B> getpress<P>
\r
635 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
638 <H2> <B>unit </B> <A
\r
639 NAME="showcursor">showcursor</A> :
\r
640 <B>procedure</B>; </H2>
\r
641 {the cursor becomes visible and follows the movements of the mouse}<P>
\r
643 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
645 <H2> <B>unit </B> <A
\r
646 NAME="hidecursor">hidecursor</A> :
\r
647 <B>procedure</B>; </H2>
\r
648 {the cursor becomes invisible}<P>
\r
650 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A><BR>
\r
652 <P align=left><B>end</B> MOUSE;<P>
\r
656 <H2>Enclosed you find a <A NAME="sample program">sample program</A> .</H2>
\r
658 Program SystemeGraph;
\r
659 (* by Frederic Pataud, October 1994 *)
\r
661 Pref iiuwgraph block (* inherit the graphic functions *)
\r
663 Pref mouse block (* inherit the mouse functions *)
\r
666 (*********************************************************************)
\r
667 (* P r o g r a m m e P r i n c i p a l *)
\r
668 (*********************************************************************)
\r
669 var v,p,h,i : integer,
\r
671 rep : arrayof char,
\r
673 xx,yy : arrayof integer,
\r
674 status,code,x,y,flags,button : integer;
\r
678 call gron(0); (* enter the graphic mode *)
\r
679 call init(1,0); (* initialize the mouse, disregard the keyboard events, check for mouse events *)
\r
681 call showcursor; (* show cursor *)
\r
682 call patern(5,5,635,475,2,0); (* make a frame around the screen *)
\r
683 call outstring(10,10,"x=",2,0);
\r
684 call outstring(100,10,"y=",2,0);
\r
685 call outstring(10,30,"status = ",2,0);
\r
686 call outstring(10,50,"code = ",2,0);
\r
687 call outstring(10,70,"flags = ",2,0);
\r
688 call outstring(10,90,"button = ",2,0);
\r
689 call patern(100,210,300,320,3,1); (* make a rectangle filled in colour 3 *)
\r
691 array xx dim (1:6);
\r
692 array yy dim (1:6);
\r
693 xx(1):=410; yy(1):=10;
\r
694 xx(2):=450; yy(2):=30;
\r
695 xx(3):=460; yy(3):=50;
\r
696 xx(4):=430; yy(4):=80;
\r
697 xx(5):=420; yy(5):=40;
\r
698 xx(6):=480; yy(6):=30;
\r
699 call intens(6,xx,yy,8,1); (* show a polygon filled*)
\r
704 call intens(6,xx,yy,15,0); (* show another polygon empty *)
\r
706 call cirb(500,300,50,40,100,3500,10,0); (* draw an empty pie or camembert *)
\r
707 call cirb(400,400,40,40,600,4000,11,1); (* draw a filled pie *)
\r
710 i:=hfont(100,350,6,-9999999,9999999,500,9,0,15); (* read integer from a window *)
\r
711 call hpage(100,400,10,unpack("Il fait beau dans ma verte campagne"),9,0); (* show text *)
\r
712 rep:=hfont8(100,430,10,80,unpack("tototutu"),9,0,15); (* read text *)
\r
714 call getmovement(1,1); (* take into consideration both key events and mouse events *)
\r
717 d:=getpress(v,p,h,l,r,c); (* ask about an event *)
\r
719 then call outstring(10,400,"Event",2,0);
\r
720 call patern(80,25,130,100,0,1);
\r
721 call track(40,10,v,0,4); (* print integer *)
\r
722 call track(140,10,p,0,4);
\r
723 call track(80,30,h,0,4);
\r
724 call track(80,50,l,0,4);
\r
725 call track(80,70,r,0,4);
\r
726 call track(80,90,c,0,4);
\r
727 if((h=164 and l=27) or (c=3)) (* exit if either two buttons were pressed c=3 or Ctrl+Esc key *)
\r
732 call groff; (* leave the graphic mode and return to the text mode *)
\r
734 for i:=lower(rep) to upper(rep)
\r
743 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
746 <Address> <A HREF = "http://www.univ-pau.fr/~salwicki/GMyAS.html">GMyAS</A> Last update Sun 7 May
\r