•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-File' ** Graphics Library
' GRAF_SMP.GFA
'
REPEAT
  CLS
  PRINT CHR$(27)+"p";
  PRINT "| <F1> rubber | <F2> drag | <F3> move |";
  PRINT " <F4> grow_shrink | <F10> quit |"
  choice|=INP(2)
  '
  SELECT choice|
  CASE 187        ! F1
    rubber
  CASE 188        ! F2
    drag
  CASE 189        ! F3
    move
  CASE 190        ! F4
    grow_shrink
  ENDSELECT
  '
  PRINT CHR$(27)+"q";
  '
UNTIL choice|=196 ! quit with F10
'
EDIT
'
PROCEDURE rubber
  GRAPHMODE 3
  DEFFILL 1,2,4
  REPEAT
    MOUSE mx%,my%,mk%
    IF mk% AND 1
      x1%=mx%
      y1%=my%
      ~GRAF_RUBBERBOX(x1%,y1%,16,16,lx%,ly%)
      PBOX x1%,y1%,x1%+lx%,y1%+ly%
    ENDIF
  UNTIL mk% AND 2
RETURN
'
PROCEDURE drag
  GRAPHMODE 3
  BOX 40,40,400,300
  lx%=50
  ly%=50
  REPEAT
    BOX lx%,ly%,lx%+150,ly%+100
    '
    REPEAT
      mk%=MOUSEK
    UNTIL mk%                     ! i.e. until mousek<>0
    '
    IF mk% AND 1                  ! left button
      BOX lx%,ly%,lx%+150,ly%+100
      ~GRAF_DRAGBOX(150,100,lx%,ly%,40,40,360,260,lx%,ly%)
      BOX lx%,ly%,lx%+150,ly%+100
    ENDIF
    BOX lx%,ly%,lx%+150,ly%+100
  UNTIL mk% AND 2                 ! right button
  GRAPHMODE 1
RETURN
    '
PROCEDURE move
  GRAPHMODE 1
  DEFFILL 1,2,4
  w%=100
  h%=100
  FOR i%=0 TO 639-w% STEP w%
    FOR j%=0 TO 399-h% STEP h%
      ~GRAF_MOVEBOX(w%,h%,i%,j%,639-i%,399-j%)
    NEXT j%
  NEXT i%
RETURN
'
PROCEDURE grow_shrink
  GRAPHMODE 1
  ~GRAF_GROWBOX(319,199,16,16,0,0,639,399)
  ALERT 0,"That was a growing box!",1,"Continue",r%
  ~GRAF_SHRINKBOX(319,199,16,16,0,0,639,399)
  ALERT 0,"That was a shrinking box!",1," Yes ",r%
RETURN

--> Pressing F1 to F4 causes the program to branch to the appropriate
    procedure. If F1 is pressed, the outline of a rectangle appears on the
    screen when the left mouse button is pressed and held down. The top left
    corner is fixed, but the diagonally opposite corner moves with the mouse.
    When the rectangle has the desired shape and size, and the left button is
    released, the rectangle is fixed and filled. More rectangles can be drawn,
    or the procedure exited by pressing the right button.

    Pressing F2 causes a small rectangle to be drawn within a larger one. With
    the left button pressed and held down, the smaller rectangle can be moved
    about within the limits imposed by the larger one. Pressing the right
    button ends the procedure.

    F3 calls up the demonstration of GRAF_MOVEBOX(), where sequences of boxes
    move round the screen. This procedure ends by itself after a few seconds.

    Finally, with F4, a growing box is drawn with GRAF_GROWBOX(), and, after
    pressing Return, a shrinking box is drawn with GRAF_SHRINKBOX().

    Pressing F10 ends the whole program.