home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / GUILIB.ZIP / DISPFUNC.C < prev    next >
C/C++ Source or Header  |  1992-11-27  |  3KB  |  108 lines

  1. #include "menu.h"
  2. #include "dos.h"
  3.  
  4. #include "graphics.h"
  5.  
  6. int font_width;
  7. int font_height;
  8. int gr_scr_xsize;
  9. int gr_scr_ysize;
  10. int txt_scr_xsize;
  11. int txt_scr_ysize;
  12.  
  13. void DisplayChar10(int,int,int,int,int);
  14.  
  15. extern unsigned char far *v_add;
  16. extern union REGS iReg,oReg;          
  17. extern int  initvar;  
  18.  
  19. unsigned char sc[4800];
  20.  
  21. /*--------------------------------------------------------------------------*/
  22. /* write a character at x,y coordinates with color as attribute             */
  23. /*--------------------------------------------------------------------------*/
  24.  
  25.  
  26. void writechar(int x,int y,unsigned char ch,int color)
  27. {
  28.   unsigned char far *scr_temp;
  29.   unsigned char far *v_add;
  30.  
  31.   if (font_width==1)
  32.   {
  33.     v_add=((void far *) (((unsigned long)(0xB800) << 16 )));
  34.     scr_temp=v_add+160*y+2*x;
  35.     *scr_temp++=ch;
  36.     *scr_temp=color;
  37.  
  38.   }
  39.   else
  40.   {  
  41.      DisplayChar10( ch,x*font_width,y*font_height,color & 0x0F, color >> 4 ); 
  42.   }
  43.   
  44.   sc[y*160+x*2]=ch;
  45.   sc[y*160+x*2+1]=color;
  46. }
  47.  
  48. /*--------------------------------------------------------------------------*/
  49. /* initialize the display board by setting the seg value                    */
  50. /* initialize the mouse                                                     */
  51. /*--------------------------------------------------------------------------*/
  52. void initdisplay(void)
  53. {
  54.   int v;
  55.  
  56.   v=get_video_mode();
  57.  
  58.   switch(v)
  59.   {
  60.     case 3 :
  61.     case 7 :
  62.      font_width=1;
  63.      font_height=1;
  64.      txt_scr_xsize=gr_scr_xsize=80;
  65.      txt_scr_ysize=gr_scr_ysize=25;
  66.      break;
  67.     case 16 :
  68.      font_width=8;
  69.      font_height=14;
  70.      gr_scr_xsize=640;
  71.      gr_scr_ysize=350;
  72.      txt_scr_xsize=gr_scr_xsize/font_width;
  73.      txt_scr_ysize=gr_scr_ysize/font_height;
  74.      break;
  75.     case 18 :
  76.      font_width=8;
  77.      font_height=16;
  78.      gr_scr_xsize=640;
  79.      gr_scr_ysize=480;
  80.      txt_scr_xsize=gr_scr_xsize/font_width;
  81.      txt_scr_ysize=gr_scr_ysize/font_height;
  82.      break;
  83.  
  84.   }
  85.   memset(sc,0,sizeof(sc));
  86.   initvar=1;
  87. }
  88. /*--------------------------------------------------------------------------*/
  89. /* return a character at x,y location of the text screen                    */
  90. /*--------------------------------------------------------------------------*/
  91. unsigned char readchar(x,y)
  92. int x;
  93. int y;
  94.   return(sc[y*160+x*2]);
  95. }
  96. /*--------------------------------------------------------------------------*/
  97. int readcolor(int x,int y)
  98. {
  99.   return(sc[y*160+x*2+1]);
  100. }
  101. /*--------------------------------------------------------------------------*/
  102. void gcurs(int action)
  103. {
  104.  
  105. }
  106. /*--------------------------------------------------------------------------*/
  107.