home *** CD-ROM | disk | FTP | other *** search
/ Black Art of 3D Game Programming / Black_Art_of_3D_Game_Programming.iso / source / borland / chap_4 / pcxdemo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-19  |  1.4 KB  |  67 lines

  1.  
  2. // PCXDEMO.C - A pcx file demo that loads a pcx file and displays it
  3.  
  4. // I N C L U D E S ///////////////////////////////////////////////////////////
  5.  
  6. #include <io.h>
  7. #include <conio.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <dos.h>
  11. #include <bios.h>
  12. #include <fcntl.h>
  13. #include <memory.h>
  14. #include <malloc.h>
  15. #include <math.h>
  16. #include <string.h>
  17.  
  18. #include "black3.h"
  19. #include "black4.h"
  20.  
  21. // G L O B A L S  ////////////////////////////////////////////////////////////
  22.  
  23. pcx_picture image_pcx;  // general PCX image used to load background and imagery
  24.  
  25.  
  26. // M A I N ///////////////////////////////////////////////////////////////////
  27.  
  28. void main(int argc, char **argv)
  29. {
  30.  
  31. // set the graphics mode to mode 13h
  32.  
  33. Set_Graphics_Mode(GRAPHICS_MODE13);
  34.  
  35. // load the screen image
  36.  
  37. PCX_Init((pcx_picture_ptr)&image_pcx);
  38.  
  39. // load a PCX file (make sure it's there)
  40.  
  41. if (PCX_Load("andre.pcx", (pcx_picture_ptr)&image_pcx,1))
  42.    {
  43.    // copy the image to the display buffer
  44.  
  45.    PCX_Show_Buffer((pcx_picture_ptr)&image_pcx);
  46.  
  47.    // delete the PCX buffer
  48.  
  49.    PCX_Delete((pcx_picture_ptr)&image_pcx);
  50.  
  51.    // wait for a keyboard press
  52.  
  53.    while(!kbhit()){}
  54.  
  55.    // use a screen transition to exit
  56.  
  57.    Screen_Transition(SCREEN_DARKNESS);
  58.  
  59.    } // end if pcx file found
  60.  
  61. // reset graphics to text mode
  62.  
  63. Set_Graphics_Mode(TEXT_MODE);
  64.  
  65. } // end main
  66.  
  67.