home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / pascal / pdial / demos / geminit.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-06-25  |  1.8 KB  |  75 lines

  1. { ------------------------------------------------------------ }
  2. { UNIT  GEMINIT                                                }
  3. { (c) 1992 Pure Software GmbH                                  }
  4. {                                                              }
  5. { the unit GemInit performs all init and exit stuff needed to  }
  6. { execute a gem program.                                       }
  7. { ------------------------------------------------------------ }
  8.  
  9. unit    GemInit;
  10.  
  11. interface
  12.  
  13. {$X+}
  14. uses    gem;
  15.  
  16. var
  17.     vdiHandle, aesHandle : Integer;
  18.     apID : Integer;
  19.     workIn : workin_ARRAY;
  20.     workOut : workout_ARRAY;
  21.     charWidth, charHeight : Integer;
  22.     boxWidth, boxHeight : Integer;
  23.  
  24.  
  25.     function    InitGem : Boolean;
  26.     procedure    ExitGem;
  27.  
  28.  
  29. implementation
  30.  
  31. { ------------------------------------------------------------ }
  32. { this procedure ends up a gem program.                        }
  33. { ------------------------------------------------------------ }
  34.  
  35. procedure    ExitGem;
  36. begin
  37.     v_clsvwk( vdiHandle );
  38.     appl_exit;
  39. end;
  40.  
  41.  
  42. { ------------------------------------------------------------ }
  43. { this function initalizes the gem. it returns true if it was  }
  44. { successful.                                                  }
  45. { ------------------------------------------------------------ }
  46.  
  47. function    InitGem : Boolean;
  48. var
  49.     i : Integer;
  50. begin
  51.     apID := appl_init;
  52.     if apID >= 0 then
  53.     begin
  54.         aesHandle := graf_handle( charWidth, charHeight, boxWidth, boxHeight );
  55.         for i := 0 to workin_max - 1 do
  56.             workIn[i] := 1;
  57.         workIn[10] := 2;
  58.         vdiHandle := aesHandle;
  59.         v_opnvwk( workIn, vdiHandle, workOut );
  60.         if vdiHandle <= 0 then
  61.         begin
  62.             appl_exit;
  63.             InitGem := False;
  64.         end
  65.         else
  66.             InitGem := True;
  67.     end
  68.     else
  69.         InitGem := False;
  70. end;
  71.  
  72. end.
  73.  
  74. { ============================================================ }
  75.