2 <HEAD><TITLE>iiuwgraph</TITLE></HEAD>
\r
3 <H1 align=center>unit IIUWGRAPH: class;</H1>
\r
4 <H2>a predefined Loglan'82 class <IMG SRC="http://www.univ-pau.fr/~salwicki/loglanmm.gif" ALT="LOGLAN"></IMG></H2>
\r
6 { this predefined class enables basic graphic operations
\r
7 for DOS machines based on <B>486</B> or 386 processors
\r
10 {this document gives the specification of new version of IIUWGRAPH
\r
12 made in October 1994 by <B><I>Frederic Pataud </I></B>à Pau}<P>
\r
14 <A NAME="Table of Contents"><B>Table of Contents</B></A>.<BR>
\r
18 <LI>unit <A HREF = "#GRON">GRON</A> : procedure (i: integer);
\r
19 <LI>unit <A HREF = "#GROFF">GROFF</A> : procedure;
\r
20 <LI>unit <A HREF = "#CLS">CLS</A> : procedure;
\r
21 <LI>unit <A HREF = "#COLOR">COLOR</A> : procedure(co : integer);
\r
22 <LI>unit <A HREF = "#STYLE">STYLE</A> : procedure(styl : integer);
\r
23 <LI>unit <A HREF = "#BORDER">BORDER</A> : procedure (background_Colour: integer);
\r
24 <LI>unit <A HREF = "#PALLET">PALLET</A> : procedure (nr : integer);
\r
25 <LI>{ PROCEDURES CONTROLLING POSITION }
\r
26 <LI>unit <A HREF = "#MOVE">MOVE</A> : procedure (x,y :integer);
\r
27 <LI>unit <A HREF = "#INXPOS">INXPOS</A> : function: integer;
\r
28 <LI>unit <A HREF = "#INYPOS">INYPOS</A> : function : integer;
\r
29 <LI>unit <A HREF = "#PUSHXY">PUSHXY</A> : procedure;
\r
30 <LI>unit <A HREF = "#POPXY">POPXY</A>: procedure;
\r
31 <LI>{ PROCEDURES SERVING POINTS LINES}
\r
32 <LI>unit <A HREF = "#POINT">POINT</A> : procedure(x,y: integer);
\r
33 <LI>unit <A HREF = "#INPIX">INPIX</A> : function (x,y : integer) : integer;
\r
34 <LI>unit <A HREF = "#DRAW">DRAW</A> : procedure( x,y : integer);
\r
35 <LI>unit <A HREF = "#intens">intens</A>: procedure(Size :integer; xCoord,yCoord:arrayof integer,
\r
36 Colour,Filled :integer);
\r
37 <li>unit <a href="#CIRB">cirb </a> {draw a circle} procedure;
\r
38 <LI>unit <A HREF = "#HFILL">hfill</A>: procedure( x : integer);
\r
39 <LI>unit <A HREF = "#VFILL">vfill</A>: procedure( y : integer);
\r
40 <LI>unit <A HREF = "#PATERN">patern</A>: procedure( x1,y1,x2,y2,c,b : integer);
\r
41 <LI>{ Procedures operating on bitmaps }
\r
42 <LI>unit <A HREF = "#GETMAP">GETMAP </A> : function (x,y : integer) : arrayof integer;
\r
43 <LI>unit <A HREF = "#PUTMAP">PUTMAP </A> : procedure ( a: arrayof integer);
\r
44 <LI>unit <A HREF = "#ORMAP">ORMAP </A> : procedure ( a : arrayof integer);
\r
45 <LI>unit <A HREF = "#XORMAP">XORMAP </A> : procedure ( a: arrayof integer);
\r
46 <LI>{Procedures operating on characters and strings}
\r
47 <LI>unit <A HREF = "#outstring">outstring</A>: procedure(x,y: integer, s: string, back_col, front_col:
\r
49 <LI>unit <A HREF = "#track">track</A>: procedure( x,y,c,valeur : integer);
\r
50 <LI>unit <A HREF = "#inkey">inkey </A> : function : integer;
\r
51 <LI>unit <A HREF = "#HASCII">HASCII </A> : procedure(c: integer);
\r
52 <LI>unit <A HREF = "#hfont">hfont</A>: function( x,y,lg,min,max,default,col_f,col_e,col_c : integer):
\r
54 <LI>unit <A HREF = "#HPAGE">HPAGE </A> : procedure(x,y,long: integer, A: arrayof char, back, front:
\r
56 <LI>unit <A HREF = "#MOUSE">MOUSE</A>: class;
\r
57 <LI>unit <A HREF = "#init">init</A>: procedure(checkMouse, checkKeyboard: integer);
\r
58 <LI>unit <A HREF = "#getmovement">getmovement</A>: procedure(checkMouse, checkKeyboard:
\r
60 <LI>unit <A HREF = "#getpress">getpress</A>: function(v,p,h,l,r,c : integer): Boolean;
\r
61 <LI>unit <A HREF = "#showcursor">showcursor</A>: procedure;
\r
62 <LI>unit <A HREF = "#hidecursor">hidecursor</A>: procedure;
\r
63 <LI> <A HREF = "#sample program">a sample program</A>
\r
70 { the early versions of library IIUWGRAPH have been elaborated by
\r
71 Piotr Carlsson, Miroslawa Milkowska, Janina Jankowska,
\r
72 Michal Jankowski at Institute of Informatics,
\r
73 University of Warsaw 1987,<P>
\r
74 and added to Loglan system by Danuta Szczepanska 1987, <P>
\r
76 the recent versions were done at LITA, Pau,<P>
\r
78 Pawel Susicki (1991) for Unix,<P>
\r
79 Sebastien Bernard (1992) for ATARI, see a separate document,<BR>
\r
80 Eric Becourt et Jerôme Larrieu (1993) for Unix and Xwindows, see a
\r
81 separate document on Xiiuwgraf ,
\r
85 fait à Pau, le 15 Novembre 1994, par Andrzej Salwicki, LITA}<P align=left>
\r
87 { the predefined class IIUWGRAPH is included in all versions of interpreter of
\r
88 Loglan, with the <I>exception</I> of the present version of interpreter for
\r
93 <B>hidden</B> MaxX, MaxY, current_X, current_Y, is_graphic_On,
\r
94 current_Colour, current_Background_Colour, current_Style,
\r
95 current_Palette, current_Pattern ;
\r
99 <B>const</B> MaxX =
\r
102 { the screen's coordinates are
\r
104 (0,0) ----------------------> (MaxX,0)
\r
109 (0, MaxY) (MaxX,MaxY)
\r
114 <B>var</B> currentDriver : integer, { see NOCARD below }
\r
115 current_X, current_Y: integer { it is the current position }
\r
116 is_graphic_On: Boolean, { evidently tells whether we are in
\r
118 current_Colour : integer, { }
\r
119 current_Background_Colour : integer,
\r
120 current_Style : integer, { }
\r
121 current_Palette : integer,
\r
125 <H2><B>unit </B> <A
\r
126 NAME="GRON"> GRON </A> <B> procedure </B>
\r
128 { procedure sets the monitor in graphic mode and clears the buffer
\r
129 of screen. The parameter determines the resolution and the number of
\r
131 The user should assure that the resolution chosen should correspond to that
\r
132 which is set by means of command <BR>
\r
133 SET go32 drivers {path}< driver.file> < width> < height> <
\r
136 set go32 drivers c:\loglan\svga\drivers\vesa.grn gw 1024 gh 480 nc 256<BR>
\r
137 <P> An execution of instruction call gron(i) <B><I>must precede</I>
\r
138 </B> any of the graphic commands described below.<P>
\r
154 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
156 <H2><B>unit</B> <A
\r
157 NAME="GROFF"> GROFF </A><B> procedure</B
\r
159 { the procedure sets the monitor in the text mode filling it with
\r
161 DO NOT FORGET to set the monitor in the text mode before
\r
162 you terminate your program<P>
\r
164 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
167 <H2><B>unit</B> <A NAME="CLS"> CLS </A> .
\r
168 : <B> procedure</B>;</H2>
\r
169 { the screen will be cleared and filled with colour 0 }<P>
\r
170 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A><P>
\r
174 <H2>{ PROCEDURES CONTROLLING THE COLOURS }</H2>
\r
177 <H2><B>unit </B> <A
\r
178 NAME="COLOR"> COLOR </A> . :
\r
179 <B> procedure</B>(co : integer);</H2>
\r
180 { sets current color to co <BR>
\r
181 for monochrome displays, 0 means black, non-0 - white<BR>
\r
182 for color displays, 0 means background<BR>
\r
185 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
187 <H2><B>unit </B> <A
\r
188 NAME="STYLE"> STYLE </A> :
\r
189 <B> procedure</B>(styl : integer);</H2>
\r
190 { sets style of lines and fill shades to a combination<P>
\r
191 of current color and background color (for mono -<P>
\r
192 white and black, respectively) according to 5 predefined<P>
\r
202 where '*' means current color, '.' background colour<P>
\r
203 When drawing the segments the subsequent pixels will have colour determined
\r
204 by cyclic application of style pattern. The first and the last pixels of a segment
\r
205 will have always current colour.<P>
\r
206 When filling contours the given style will be applied to horizontal lines with even
\r
207 coordinate. The style for odd lines is determined automatically.<P>
\r
208 The same applies for perpendicular lines.<P>
\r
211 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
213 <H2><B>unit </B> <A
\r
214 NAME="BORDER"> BORDER </A> . :
\r
215 <B>procedure</B> (background_Colour:
\r
218 <P> { sets actual background color to i ( i = 0,1,...,15 ) }<P>
\r
220 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
222 <H2><B>unit </B> <A
\r
223 NAME="PALLET"> PALLET </A> :
\r
224 <B>procedure</B> (nr : integer);</H2>
\r
225 {the following line makes an example, it is not valid for, say,
\r
228 the codes of colors are <I>usually i.e. when you have 16 colours,</I> as follows<P>
\r
248 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
252 <H2>{ PROCEDURES CONTROLLING POSITION }</H2>
\r
254 <H2><B>unit </B> <A
\r
255 NAME="MOVE">MOVE</A> :
\r
256 <B>procedure</B> (x,y :integer);</H2>
\r
257 { procedure MOVE sets the current position on the screen on the pixel
\r
258 with coordinates<P>
\r
261 { precondition of MOVE:
\r
262 <I>0*x*MaxX & 0*y*MaxY </I>
\r
264 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
266 <H2><B>unit </B> <A
\r
267 NAME="INXPOS">INXPOS</A> :
\r
268 <B>function</B>: integer;</H2>
\r
269 { function INXPOS returns the x coordinate of the current position }<P>
\r
270 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
273 <H2><B>unit </B> <A
\r
274 NAME="INYPOS">INYPOS</A> :
\r
275 <B>function</B> : integer;</H2>
\r
276 { function INYPOS returns the y coordinate of the current position }<P>
\r
277 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
280 <H2><B>unit </B> <A
\r
281 NAME="PUSHXY">PUSHXY</A> :
\r
282 <B>procedure</B>;</H2>
\r
283 { pushes current position, color & style onto the stack.<P>
\r
284 The stack is kept internally, max depth is 16<P>
\r
287 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
289 <H2><B>unit </B><A
\r
290 NAME="POPXY">POPXY</A> :
\r
291 <B>procedure</B>;</H2>
\r
293 { restores position, color & style from internal stack }<P>
\r
296 <PRE>unit DIAGONAL : procedure;
\r
297 var ix, iy : integer;
\r
302 call DRAW(ix+10, iy+10);
\r
307 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
310 <H2>{ PROCEDURES SERVING POINTS &
\r
313 <H2><B>unit </B> <A
\r
314 NAME="POINT">POINT</A> :
\r
315 <B>procedure</B>(x,y: integer);</H2>
\r
316 { moves current position to pixel (x,y) and sets it to the current color
\r
318 }<P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
321 <H2><B>unit </B> <A
\r
322 NAME="INPIX">INPIX</A> : <B>function</B>
\r
323 (x,y : integer) : integer;</H2>
\r
325 moves to pixel (x,y) and returns its color setting;<P>
\r
327 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
330 <H2><B>unit </B> <A
\r
331 NAME="DRAW">DRAW</A> :
\r
332 <B>procedure</B>( x,y : integer);</H2>
\r
334 draws a line from current screen position to (<I>x,y</I>);<P>
\r
335 sets current position to (<I>x,y</I>);<P>
\r
336 line is drawn in current color, with both terminal pixels<P>
\r
337 always turned white ( non-background) for non-black<P>
\r
338 ( non-background ) line color.<P>
\r
340 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
342 <H2><B>unit </B> <A
\r
343 NAME="intens">intens</A> :
\r
344 <B>procedure</B>(Size :integer;
\r
345 xCoord,yCoord:arrayof integer, Colour,Filled
\r
348 /* draw a polygon*/
\r
349 { draw a simple, closed polygon of Size points, the edges of the polygon go from
\r
350 (<I>xCoord[i], yCoord[i]</I>) to (<I>xCoord[i+1], yCoord[i+1]</I>) for i = 1, ..., Size-1
\r
351 The colour used will be <I>Colour</I>. The polygon will be filled iff <I>Filled</I><
\r
354 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
356 <H2><B>unit </B><A NAME="CIRB"> CIRB</A> : <B>procedure</B> (xi, yi, rx,ry : integer, alfa, beta : real,
\r
357 cbord, fill : integer);<P></H2>
\r
361 <P> draws a circle (or ellipse, depending on aspect value, see below),<P>
\r
362 optionally filling its interior; <P>
\r
363 does not preserve position;<P>
\r
364 (<I>xi,yi</I>) - are center coordinates,<P>
\r
365 <I>rx</I> - radius in pixels (horizontally),<BR>
\r
366 <I>ry</I> - radius in pixels (perpendicularly),<P>
\r
367 <I>alfa, beta</I> - starting & ending angles; if alfa=beta a full<P>
\r
368 circle is drawn; values should be given in radians;<P>
\r
369 <I>cbord</I> - border color,<P>
\r
370 <I>fill</I> - if fill < > 0, interior is filled in current style& color<P>
\r
372 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
374 <H2><B>unit </B> <A NAME="hfill">hfill</A> :
\r
375 <B>procedure</B>( x : integer);</H2>
\r
376 { draw an horizontal line between the current position and<P>
\r
377 (x,currentY) with the current color, after it change the current<P>
\r
378 position to (x, currentY)<P>
\r
380 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
382 <H2><B>unit </B><A NAME="vfill">vfill</A> :
\r
383 <B>procedure</B>( y : integer);</H2>
\r
384 { draw a vertical line between the current position and<P>
\r
385 (currentX,y) with the current color, after it change the current<P>
\r
386 position to (currentX,y)<P>
\r
388 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
390 <H2><B>unit </B> <A
\r
391 NAME="patern">patern</A> :
\r
392 <B>procedure</B>( x1,y1,x2,y2,c,b :
\r
394 { draw a <B><I>rectangle</I></B> between the points (<I>x1,y1</I>) and
\r
395 (<I>x2</I>,<I>y2</I>) with the<P>
\r
396 color <I>c</I> (the current color is not change). if <I>b</I>=0 then the box
\r
398 empty else it is filled.<P>
\r
400 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
402 <H2>{ Procedures operating on bitmaps }</H2>
\r
404 <H2><B>unit </B> <A
\r
405 NAME="GETMAP">GETMAP</A> :
\r
406 <B>function</B> (x,y : integer) : <B>arrayof</B>
\r
408 {saves rectangular area between current position as<P>
\r
409 top left corner and (ix,iy) as bottom right corner,<P>
\r
410 including border lines;<P>
\r
411 position remains unchanged.<P>
\r
412 array of integer should have <P>
\r
413 4+(rows**columns/8* *coeff)<P>
\r
414 bytes. The coefficient coeff is 1 for Hercules, 2 for CGA, 4 for EGA<P>
\r
416 ATTENTION: in DOS 286 environment a bigger size of the array may
\r
417 necessitate the use of <I>loglan</I> with<I> the option H+</I>, see also
\r
420 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
422 <H2><B>unit </B> <A
\r
423 NAME="PUTMAP">PUTMAP</A> :
\r
424 <B>procedure</B> ( a: <B>arrayof</B>
\r
426 {sets rectangular area of screen pixels to that saved<P>
\r
427 by "getmap" in "iarray";<P>
\r
428 same size is restored, with top left corner in current<P>
\r
430 position remains unchanged.<P>
\r
432 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
434 <H2><B>unit </B> <A
\r
435 NAME="ORMAP">ORMAP</A> :
\r
436 <B>procedure</B> ( a : <B>arrayof
\r
438 {same as putmap, but saved bitmap is or'ed into screen<P>
\r
439 rather than just set.<P>
\r
441 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
443 <H2><B>unit </B> <A NAME="XORMAP
\r
444 ">XORMAP </A> : <B>procedure</B> ( a:
\r
445 <B>arrayof</B> integer);</H2>
\r
446 {same as putmap, but saved bitmap is xor'ed into screen<P>
\r
447 rather than just set.<P>
\r
449 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
452 <H2>{Procedures operating on characters and strings}</H2>
\r
454 <H2><B>unit </B> <A
\r
455 NAME="outstring">outstring</A> :
\r
456 <B>procedure</B>(x,y: integer, s: string, back_col,
\r
457 front_col: integer);</H2>
\r
458 { <I>x, y</I> are the coordinates where to put the string,<P>
\r
459 <I>s</I> is the string to be shown, in <I>front_col</I> colour letters on the
\r
460 <I>back_col</I> colour background<P>
\r
462 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
464 <H2><B>unit </B> <A NAME="track">track</A>
\r
465 : <B>procedure</B>( x,y,c,valeur : integer);
\r
467 { write an integer value <I>valeur</I> at the position (<I>x,y</I>) with the
\r
469 It does not change the current position nor the current color<P>
\r
471 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
473 <H2><B>unit </B> <A NAME="inkey ">inkey
\r
474 </A> : <B>function</B> : integer;</H2>
\r
476 { returns next character from keyboard buffer;<P>
\r
477 0 is returned if buffer is empty;<P>
\r
478 special keys are returned as negative numbers;<P>
\r
479 ALT-NUM method may be used for entering character codes<P>
\r
480 above 127 (this makes entering special keys 128-132<P>
\r
482 if a character is returned, it is also removed<P>
\r
483 from the buffer, so MS-DOS will not see it (CTRL-C!);<P>
\r
484 typeahead is allowed, echo is suppressed.<P>
\r
486 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
488 <H2><B>unit </B> <A NAME="HASCII
\r
489 ">HASCII </A> : <B>procedure</B>(c:
\r
491 {'xor's the character = chr(c) in a 8*8 box with top left corner<P>
\r
492 in the current position;<P>
\r
493 moves current position by (8,0);<P>
\r
494 call hascii(0)- sets complete box to black ( =background ),<P>
\r
495 with no change in position.<P>
\r
497 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
501 <H2><B>unit </B><A NAME="hfont">hfont</A>
\r
502 : <B>function</B>(
\r
503 x,y,lg,min,max,default,col_f,col_e,col_c : integer):
\r
506 { arrange a small 1 line window for <B><I>reading</I></B> an integer value
\r
508 the position of the window corner is (<I>x, y</I>),
\r
509 the length of the window is <I>lg</I> characters,
\r
510 the value v should be greater than <I>min</I> and smaller than <I>max</I>,
\r
511 the default value read is <I>default</I>,<P>
\r
512 the colour of the window is <I>col_f</I>,<BR>
\r
513 the colour of the digits is <I>col_e,</I><BR>
\r
514 the colour of cursor is <I>col_c</I><P>
\r
516 reads in graphic mode an integer in the window which begins at the (x,y)
\r
517 position, window is lg caracteres long. the maximum length of the<P>
\r
518 integer that is read is 10. there is a default value, a minimum value
\r
519 and a maximum value. the window is drawn with the col_f color, the
\r
520 cursor is in the col_c color and the integer is writing in the col_e<P>
\r
521 color. you can use 0..9,+,-,backspace,escape and return keys. }<P>
\r
522 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
525 <H2><B>unit </B> <A NAME="HPAGE
\r
526 ">HPAGE </A> : <B>procedure</B>(x,y,long:
\r
527 integer, A: arrayof char, back, front: integer);</H2>
\r
528 { this procedure arranges a 1-line high window in position <I>x,y</I> of
\r
529 length <I>long</I> in which a portion of text <I>A</I> is shown in colour
\r
530 <I>front</I> on the background colour <I>back</I>. <P>
\r
531 Making use of keys controlling the cursor {left, right, PgUp, PgDn}<P>
\r
532 the user can scroll the text (horizontally) in the window. Pressing the
\r
533 Enter key terminates the procedure} <P>
\r
534 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
536 <P align=left><B>end</B> IIUWGRAPH;<P>
\r
541 <P><H2><B>unit </B> <A
\r
542 NAME="MOUSE">MOUSE</A> .:
\r
543 <B>class</B>; </H2>
\r
545 <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
546 fonction getpress; le premier et le deuxième paramètre représentent respectivement la souris et le clavier, si une
\r
547 valeur non nulle est donnée comme paramètre alors getpress réagira à l'événement.<P>
\r
549 Une paire (1,1) va permettre de prendre en compte à la fois les événements de la souris et ceux du clavier;
\r
550 une paire (1,0) quand à elle ne prendra en compte que la souris. Pour une plus grande souplesse d'utilisation, il est
\r
551 possible lors du programme, après l'initalisation, de changer cette prise en compte, cela se fera par l'appel de la
\r
552 procedure <I>getmovement</I>, procédure ayant les mêmes paramètres (avec le même ordre) que la fonction
\r
555 Pour detecter les événements, on utilisa la fonction <I>getpress</I>, qui retourne un booléen indiquant la
\r
556 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
557 fonction getpress n'est pas bloquante. Les paramètres en retour sont soit nuls (pas d'événement) soit
\r
560 bool:=getpress(v,p,h,l,r,c : integer);<P>
\r
561 v = position en y de la souris<P>
\r
562 p = keyboard status (Touche control_left,control_right, alt, alt_gr, shift_left, shift_right)<P>
\r
563 h = position en x de la souris<P>
\r
564 l = touche clavier<P>
\r
566 c = boutons de la souris (0=aucun, 1=gauche, 2=droite, 3=gauche et droite)<P>
\r
567 Nb: le bouton central n'est pas géré.<P>
\r
569 NOTEZ BIEN! Lorsque les événements du clavier sont pris en compte dans le gestionnaire, <B>il</B> <B>ne faut
\r
570 pas </B>utiliser les fonctions d'entrées clavier readl, readln, hfont, hfont8, hpage, inkey,...) <I>sous peine de
\r
571 plantage de l'ordinateur</I>.<P>
\r
575 <H2> <B>unit </B> <A NAME="init">init</A>
\r
576 : <B>procedure</B>(checkMouse,
\r
577 checkKeyboard: integer); </H2>
\r
578 { initializes the Mouse driver.<P>
\r
579 tells which events will be checked:<P>
\r
580 if checkMouse < > 0 then the events of Mouse will be reported to getpress, see below otherwise
\r
582 if checkKeyboard < > 0 then the events of Keyboard will be reported to getpress, otherwise ignored<P>
\r
583 <B><I>Attention please!</I></B> While the events of the keyboard are taken under control by
\r
584 <I>init</I> or <I>getmovement</I><P>
\r
585 <B><I>do not use</I></B> the functions or procedures: read, readln, hfont, hfont8, hpage, inkey
\r
587 YOU RISK TO HANG YOUR SYSTEM!<P>
\r
589 <B>end</B> init <P>
\r
590 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
592 <H2><B> unit </B><A
\r
593 NAME="getmovement">getmovement</A> :
\r
594 <B>procedure</B>(checkMouse, checkKeyboard:
\r
596 tells which events will be checked:<P>
\r
597 if checkMouse < > 0 then the events of Mouse will be reported to getpress, see below otherwise
\r
599 if checkKeyboard < > 0 then the events of Keyboard will be reported to getpress, otherwise ignored<P>
\r
600 <B><I>Attention please!</I></B> While the events of the keyboard are taken under control by
\r
601 <I>init</I> or <I>getmovement</I><P>
\r
602 <B><I>do not use</I></B> the functions or procedures: read, readln, hfont, hfont8, hpage, inkey
\r
604 YOU RISK TO HANG YOUR SYSTEM!<P>
\r
605 <B>end</B> getmovement;<P>
\r
606 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
608 <H2><B> unit </B> <A
\r
609 NAME="getpress">getpress</A> :
\r
610 <B>function</B>(v,p,h,l,r,c : integer):
\r
612 { <I>v</I> = y coordinate of the cursor,<P>
\r
613 <I>h</I> = x coordinate of the cursor,<P>
\r
614 <I>p</I> = keybord status control_left,control_right, alt, alt_gr, shift_left, shift_right<P>
\r
615 <I>l</I> = code of key pressed<P>
\r
616 <I>r</I> = flags<P>
\r
617 <I>c</I> = buttons pressed (0=aucun, 1=gauche, 2=droite, 3=gauche et droite)<P>
\r
618 Nb: the middle button is not taken into account.<P>
\r
619 <B>end</B> getpress<P>
\r
620 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
623 <H2> <B>unit </B> <A
\r
624 NAME="showcursor">showcursor</A> :
\r
625 <B>procedure</B>; </H2>
\r
626 {the cursor becomes visible and follows the movements of the mouse}<P>
\r
628 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
630 <H2> <B>unit </B> <A
\r
631 NAME="hidecursor">hidecursor</A> :
\r
632 <B>procedure</B>; </H2>
\r
633 {the cursor becomes invisible}<P>
\r
635 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A><BR>
\r
637 <P align=left><B>end</B> MOUSE;<P>
\r
641 <H2>Enclosed you find a <A NAME="sample program">sample program</A> .</H2>
\r
643 Program SystemeGraph;
\r
644 (* by Frederic Pataud, October 1994 *)
\r
646 Pref iiuwgraph block (* inherit the graphic functions *)
\r
648 Pref mouse block (* inherit the mouse functions *)
\r
651 (*********************************************************************)
\r
652 (* P r o g r a m m e P r i n c i p a l *)
\r
653 (*********************************************************************)
\r
654 var v,p,h,i : integer,
\r
656 rep : arrayof char,
\r
658 xx,yy : arrayof integer,
\r
659 status,code,x,y,flags,button : integer;
\r
663 call gron(0); (* enter the graphic mode *)
\r
664 call init(1,0); (* initialize the mouse, disregard the keyboard events, check for mouse events *)
\r
666 call showcursor; (* show cursor *)
\r
667 call patern(5,5,635,475,2,0); (* make a frame around the screen *)
\r
668 call outstring(10,10,"x=",2,0);
\r
669 call outstring(100,10,"y=",2,0);
\r
670 call outstring(10,30,"status = ",2,0);
\r
671 call outstring(10,50,"code = ",2,0);
\r
672 call outstring(10,70,"flags = ",2,0);
\r
673 call outstring(10,90,"button = ",2,0);
\r
674 call patern(100,210,300,320,3,1); (* make a rectangle filled in colour 3 *)
\r
676 array xx dim (1:6);
\r
677 array yy dim (1:6);
\r
678 xx(1):=410; yy(1):=10;
\r
679 xx(2):=450; yy(2):=30;
\r
680 xx(3):=460; yy(3):=50;
\r
681 xx(4):=430; yy(4):=80;
\r
682 xx(5):=420; yy(5):=40;
\r
683 xx(6):=480; yy(6):=30;
\r
684 call intens(6,xx,yy,8,1); (* show a polygon filled*)
\r
689 call intens(6,xx,yy,15,0); (* show another polygon empty *)
\r
691 call cirb(500,300,50,40,100,3500,10,0); (* draw an empty pie or camembert *)
\r
692 call cirb(400,400,40,40,600,4000,11,1); (* draw a filled pie *)
\r
695 i:=hfont(100,350,6,-9999999,9999999,500,9,0,15); (* read integer from a window *)
\r
696 call hpage(100,400,10,unpack("Il fait beau dans ma verte campagne"),9,0); (* show text *)
\r
697 rep:=hfont8(100,430,10,80,unpack("tototutu"),9,0,15); (* read text *)
\r
699 call getmovement(1,1); (* take into consideration both key events and mouse events *)
\r
702 d:=getpress(v,p,h,l,r,c); (* ask about an event *)
\r
704 then call outstring(10,400,"Event",2,0);
\r
705 call patern(80,25,130,100,0,1);
\r
706 call track(40,10,v,0,4); (* print integer *)
\r
707 call track(140,10,p,0,4);
\r
708 call track(80,30,h,0,4);
\r
709 call track(80,50,l,0,4);
\r
710 call track(80,70,r,0,4);
\r
711 call track(80,90,c,0,4);
\r
712 if((h=164 and l=27) or (c=3)) (* exit if either two buttons were pressed c=3 or Ctrl+Esc key *)
\r
717 call groff; (* leave the graphic mode and return to the text mode *)
\r
719 for i:=lower(rep) to upper(rep)
\r
728 <P ALIGN=RIGHT><A HREF = "#Table of Contents">to ToC</A>
\r
731 <Address> <A HREF = "http://www.univ-pau.fr/~salwicki/GMyAS.html">GMyAS</A> Last update Sun 7 May
\r