$INCLUDE: 'C:\FG\INTRFACE.FOR'

      PROGRAM MAIN

      INTEGER*2 OLD_MODE, NEW_MODE
      INTEGER*2 FG_BESTMODE, FG_GETMODE

      NEW_MODE = FG_BESTMODE(320,200,1)
      IF (NEW_MODE .LT. 0) THEN
         STOP 'This program requires a 320 x 200 graphics mode.'
      END IF

      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(NEW_MODE)

      CALL FG_SETCOLOR(10)
      CALL FG_MOVE(100,50)
      CALL FG_DRAWREL(120,0)
      CALL FG_DRAWREL(0,100)
      CALL FG_DRAWREL(-120,0)
      CALL FG_DRAWREL(0,-100)

      CALL FG_SETCOLOR(9)
      CALL FG_MOVE(160,80)
      CALL FG_DRAWREL(30,20)
      CALL FG_DRAWREL(-30,20)
      CALL FG_DRAWREL(-30,-20)
      CALL FG_DRAWREL(30,-20)
      CALL FG_WAITKEY

      CALL FG_SETCOLOR(10)
      CALL FG_PAINT(160,70)
      CALL FG_WAITKEY

      CALL FG_SETCOLOR(15)
      CALL FG_PAINT(160,100)
      CALL FG_WAITKEY

      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      STOP ' '
      END
