home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 499.lha / InputDeviceToolKit / input.lzh / src / DeviceToolKits / Input / test_shared / test5.c < prev    next >
C/C++ Source or Header  |  1991-01-05  |  2KB  |  77 lines

  1. #include <stdio.h>
  2.  
  3. #include "DeviceToolKits/Input.h"
  4. #ifndef  TESTPROTO
  5. #define  NO_PRAGMAS  1
  6. #endif
  7. #include "DeviceToolKits/proto/Input.h"
  8. #include "DeviceToolKits/InputBase.h"
  9.  
  10. DTInput_t                  Unit0;
  11. BYTE                       port;
  12. BYTE                       type;
  13. struct   GamePortTrigger   trigger;
  14.  
  15. main(argc,argv)
  16. int   argc;
  17. char  *argv[];
  18. {
  19.    long  status;
  20.  
  21. #ifdef   TESTSHARED
  22. /*  Open the Input library  */
  23.  
  24.    DTInputOpen(DTINPUTREV);
  25. #endif
  26.  
  27. /*  Try to initialize unit 0 of the Input  */
  28.  
  29.    printf("Move the mouse connector to the right port for this test.\n");
  30.    fflush(stdout);
  31.  
  32.    if ((Unit0 = DTInputCreate(&status)) == NULL) {
  33.       fprintf(stderr,"Error initializing unit 0 = %ld.\n",status);
  34.       fflush(stderr);
  35.       goto cleanup;
  36.    }
  37.  
  38.    fprintf(stderr,"Unit0 = %lX\n",(long) Unit0);
  39.    fflush(stderr);
  40.  
  41. /*  Set the input port to the right port  */
  42.  
  43.    port = 1;
  44.    if ((status = DTInputSetMPort(Unit0,&port)) != 0) {
  45.       fprintf(stderr,"Error setting unit 0 port = %ld,%ld.\n",
  46.                status,Unit0->in_error);
  47.       fflush(stderr);
  48.       goto cleanup;
  49.    }
  50.  
  51. /*  Wait while the user plays  */
  52.  
  53.    printf("In 30 seconds, the mouse will revert to the left port.\n");
  54.    printf("Try moving the pointer with the mouse in the right port.\n");
  55.    fflush(stdout);
  56.    Delay(30L*60L);
  57.  
  58. /*  Set the input port back to the left port  */
  59.  
  60.    port = 0;
  61.    if ((status = DTInputSetMPort(Unit0,&port)) != 0) {
  62.       fprintf(stderr,"Error setting unit 0 port = %ld,%ld.\n",
  63.                status,Unit0->in_error);
  64.       fflush(stderr);
  65.       goto cleanup;
  66.    }
  67.  
  68. /*  Free the stuff  */
  69.  
  70. cleanup:
  71.    DTInputFree(Unit0);
  72. #ifdef   TESTSHARED
  73.    DTInputClose();
  74. #endif
  75. }
  76.  
  77.