home *** CD-ROM | disk | FTP | other *** search
/ Learn 3D Graphics Programming on the PC / Learn_3D_Graphics_Programming_on_the_PC_Ferraro.iso / rwdos / doswrap.h < prev    next >
C/C++ Source or Header  |  1995-02-15  |  6KB  |  297 lines

  1. /****************************************************************************
  2.  *                                                                          *
  3.  *                            DOSWRAP.H                                     *
  4.  *                                                                          *
  5.  ***************************************************************************/
  6.  
  7. #ifndef DOSWRAP_PROTO
  8. #define DOSWRAP_PROTO
  9.  
  10. #include "rwdos.h"
  11.  
  12. /****************************************************************************
  13.  RwDPrintChar
  14.  
  15.  On entry    : Xcord
  16.                     : Ycord
  17.                     : Character
  18.                     : Color
  19.  */
  20.  
  21. void RwDPrintChar(int nX,
  22.                                     int nY,
  23.                                     int nC,
  24.                                     int nColor)
  25. {
  26.     RwPrintChar pcPrint;
  27.  
  28.     pcPrint.x = nX;
  29.     pcPrint.y = nY;
  30.     pcPrint.c = nC;
  31.     pcPrint.color = nColor;
  32.  
  33.     RwDeviceControl(rwPRINTCHAR,0, &pcPrint, sizeof(RwPrintChar));
  34. }
  35.  
  36. /****************************************************************************
  37.  RwDPointerRemove
  38.  
  39.  On entry    :
  40.  On exit    :
  41.  */
  42.  
  43. void RwDPointerRemove(void)
  44. {
  45.     RwDeviceControl(rwPOINTERREMOVE,0,NULL, 0);
  46. }
  47.  
  48. /****************************************************************************
  49.  RwDPointerDisplay
  50.  
  51.  On entry    : xcord (out)
  52.                     : ycord (out)
  53.                     : buttons (out)
  54.  On exit  :
  55.  */
  56.  
  57. void RwDPointerDisplay(int *pX,
  58.                                              int *pY,
  59.                                              int *pBut)
  60. {
  61.     RwMousePointer mMouse;
  62.  
  63.     RwDeviceControl(rwPOINTERDISPLAY,0,&mMouse, sizeof(RwMousePointer));
  64.     (*pX) = mMouse.x;
  65.     (*pY) = mMouse.y;
  66.     (*pBut) = mMouse.buttons;
  67. }
  68.  
  69. /****************************************************************************
  70.  RwDPointerDisplayAt
  71.  
  72.  On entry    : xcord
  73.                     : ycord
  74.  On exit  :
  75.  */
  76.  
  77. void RwDPointerDisplayAt(int nX,
  78.                                                int nY)
  79. {
  80.     RwMousePointer mMouse;
  81.  
  82.     mMouse.x = nX;
  83.     mMouse.y = nY;
  84.  
  85.     RwDeviceControl(rwPOINTERDISPLAYAT,0,&mMouse, sizeof(RwMousePointer));
  86. }
  87.  
  88. /****************************************************************************
  89.  RwDPointerGetPosition
  90.  
  91.  On entry    : xcord (out)
  92.                     : ycord (out)
  93.                     : buttons (out)
  94.  On exit  :
  95.  */
  96.  
  97. void RwDPointerGetPosition(int *pX,
  98.                                                  int *pY,
  99.                                                  int *pBut)
  100. {
  101.     RwMousePointer mMouse;
  102.  
  103.     RwDeviceControl(rwPOINTERGETPOSITION,0,&mMouse, sizeof(RwMousePointer));
  104.     (*pX) = mMouse.x;
  105.     (*pY) = mMouse.y;
  106.     (*pBut) = mMouse.buttons;
  107. }
  108.  
  109. /****************************************************************************
  110.  RwDPointerSetPosition
  111.  
  112.  On entry    : xcord
  113.                     : ycord
  114.  On exit  :
  115.  */
  116.  
  117. void RwDPointerSetPosition(int nX,
  118.                                                  int nY)
  119. {
  120.     RwMousePointer mMouse;
  121.  
  122.     mMouse.x = nX;
  123.     mMouse.y = nY;
  124.  
  125.     RwDeviceControl(rwPOINTERSETPOSITION,0,&mMouse, sizeof(RwMousePointer));
  126. }
  127.  
  128. /****************************************************************************
  129.  RwDPointerGetRelative
  130.  
  131.  On entry    : xcord (out)
  132.                     : ycord (out)
  133.                     : buttons (out)
  134.  On exit  :
  135.  */
  136.  
  137. void RwDPointerGetRelative(int *pX,
  138.                                              int *pY,
  139.                                              int *pBut)
  140. {
  141.     RwMousePointer mMouse;
  142.  
  143.     RwDeviceControl(rwPOINTERGETRELATIVE,0,&mMouse, sizeof(RwMousePointer));
  144.     (*pX) = mMouse.x;
  145.     (*pY) = mMouse.y;
  146.     (*pBut) = mMouse.buttons;
  147. }
  148.  
  149. /****************************************************************************
  150.  RwDBitmapToRaw
  151.  
  152.  On entry    : In bitmap
  153.                     : width
  154.                     : Height
  155.                     : Color
  156.                     : Outstorage (OUT)
  157.  On exit  : Pointer to raw created
  158.  */
  159.  
  160. void *RwDBitmapToRaw(void *pInImage,
  161.                                          int nWidth,
  162.                                          int nHeight,
  163.                                          int nColor,
  164.                                          void *pStorage)
  165. {
  166.     RwImageConvert ciConvert;
  167.  
  168.     ciConvert.inimage = pInImage;
  169.     ciConvert.w = nWidth;
  170.     ciConvert.h = nHeight;
  171.     ciConvert.colora = nColor;
  172.     ciConvert.outstorage = pStorage;
  173.  
  174.     RwDeviceControl(rwBITMAPTORAW,0,&ciConvert, sizeof(RwImageConvert));
  175.  
  176.     return ciConvert.outstorage;
  177. }
  178.  
  179.  
  180. /****************************************************************************
  181.  RwDCharmapToRaw
  182.  
  183.  On entry    : In charmap
  184.                     : width
  185.                     : Height
  186.                     : ColorA
  187.                     : ColorB
  188.                     : Outstorage (OUT)
  189.  On exit  : Pointer to raw created
  190.  */
  191.  
  192. void *RwDCharmapToRaw(void *pInImage,
  193.                                          int nWidth,
  194.                                          int nHeight,
  195.                                          int nColorA,
  196.                                          int nColorB,
  197.                                          void *pStorage)
  198. {
  199.     RwImageConvert ciConvert;
  200.  
  201.     ciConvert.inimage = pInImage;
  202.     ciConvert.w = nWidth;
  203.     ciConvert.h = nHeight;
  204.     ciConvert.colora = nColorA;
  205.     ciConvert.colorb = nColorB;
  206.     ciConvert.outstorage = pStorage;
  207.  
  208.     RwDeviceControl(rwCHARMAPTORAW,0,&ciConvert, sizeof(RwImageConvert));
  209.  
  210.     return ciConvert.outstorage;
  211. }
  212.  
  213. /****************************************************************************
  214.  RwDPointerSetRegion
  215.  
  216.  On entry    : min x
  217.                     : min y
  218.                     : max x
  219.                     : max y
  220.  On exit    :
  221.  */
  222.  
  223. void RwDPointerSetRegion(int nMinX,
  224.                                                  int nMinY,
  225.                                                  int nMaxX,
  226.                                                  int nMaxY,
  227.                                                  int nSpeed)
  228. {
  229.     RwRect rRect;
  230.  
  231.     rRect.x = nMinX;
  232.     rRect.y = nMinY;
  233.     rRect.w = nMaxX - nMinX;
  234.     rRect.h = nMaxY - nMinY;
  235.  
  236.     RwDeviceControl(rwPOINTERSETREGION,nSpeed,&rRect, sizeof(RwRect));
  237. }
  238.  
  239. /****************************************************************************
  240.  RwDPointerSetClipRegion
  241.  
  242.  On entry    : min x
  243.                     : min y
  244.                     : max x
  245.                     : max y
  246.  On exit    :
  247.  */
  248.  
  249. void RwDPointerSetClipRegion(int nMinX,
  250.                                                  int nMinY,
  251.                                                  int nMaxX,
  252.                                                  int nMaxY)
  253. {
  254.     RwRect rRect;
  255.  
  256.     rRect.x = nMinX;
  257.     rRect.y = nMinY;
  258.     rRect.w = nMaxX - nMinX;
  259.     rRect.h = nMaxY - nMinY;
  260.  
  261.     RwDeviceControl(rwPOINTERSETCLIPREGION,0,&rRect, sizeof(RwRect));
  262. }
  263.  
  264. /****************************************************************************
  265.  RwDPointerSetImage
  266.  
  267.  On entry    : Hotspot X
  268.                     : Hotspot Y
  269.                     : Width/ColorA
  270.                     : Height/ColorB
  271.                     : Image (NULL - defualt pointer image)
  272.  On exit    :
  273.  */
  274.  
  275. void RwDPointerSetImage(int nHotX,
  276.                                                 int nHotY,
  277.                                                 int nWidth,
  278.                                                 int nHeight,
  279.                                                 void *pImage)
  280. {
  281.     RwPointerImage piImage;
  282.  
  283.  
  284.     piImage.hotx = nHotX;
  285.     piImage.hoty = nHotY;
  286.     piImage.w = nWidth;
  287.     piImage.h = nHeight;
  288.     piImage.image= pImage;
  289.  
  290.     RwDeviceControl(rwPOINTERSETIMAGE,0,&piImage, sizeof(RwPointerImage));
  291. }
  292.  
  293. #endif
  294.  
  295.  
  296.  
  297.