Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

video.c

Go to the documentation of this file.
00001 /**********************************************************************
00002 * FILE: video.c
00003 * AUTHOR: Christopher L
00004 * DATE: 18 April 1993
00005 * PURPOSE:
00006 *   Contains the device class Video, which initializes BGI
00007 *   graphics.
00008 ***********************************************************************/
00009 
00010 #include <stdio.h>
00011 #include <conio.h>
00012 #include <stdlib.h>
00013 #include "video.h"
00014 
00015 /**********************************************************************
00016 * Constructor
00017 ***********************************************************************/
00018 
00019 Video::Video (VideoModes mode) : Mode (mode)
00020 {
00021   int gdriver, gmode, err;
00022   void far *driver;
00023 
00024   switch (Mode)     // Check the video mode
00025   {
00026     case VGAHi:
00027       gdriver = VGA;
00028       gmode   = VGAHI;
00029       break;
00030     default:
00031       gdriver = DETECT;
00032   };
00033 
00034 #ifdef LINK_BGI
00035   switch (Mode)
00036   {
00037     case VGAHi:
00038       driver = EGAVGA_driver_far;
00039       break;
00040   }
00041 
00042   err = registerfarbgidriver(driver); // Register the driver (linked in)
00043   if (err < 0)
00044   {
00045     printf("Graphics error: %s\n", grapherrormsg(err));
00046     printf("Press any key to halt:\n");
00047     getch();
00048     exit(1); /* terminate with an error code */
00049   }
00050 #endif
00051 #ifdef LINK_FONT
00052   registerfarbgifont (triplex_font_far);  // Register linked fonts
00053   registerfarbgifont (gothic_font_far);
00054   registerfarbgifont (small_font_far);
00055   registerfarbgifont (sansserif_font_far);
00056 #endif
00057 
00058   initgraph(&gdriver, &gmode, "");  // Initialize graphics
00059   err = graphresult();
00060   if (err != grOk)  /* an error occurred */
00061   {
00062     printf("Graphics error: %s\n", grapherrormsg(err));
00063     printf("Press any key to halt:\n");
00064     getch();
00065     exit(1); /* terminate with an error code */
00066   }
00067 
00068 }
00069 
00070 /**********************************************************************
00071 * Destructor
00072 ***********************************************************************/
00073 
00074 Video::~Video (void)
00075 {
00076   closegraph ();
00077 }
00078 
00079 

Generated on Sun Jul 6 23:07:16 2003 for Scotland Yard by doxygen1.2.15