Category : C Source Code
Archive   : RXGRAPH.ZIP
Filename : RXDRAW.C

 
Output of file : RXDRAW.C contained in archive : RXGRAPH.ZIP

/* Standard headers from Microsoft */
#include
#include
#include
#include "bitmap.h"

static char mode;
static int num_cols;
static int num_colors;
static int result;
#define num_rows 200

/* return 1 (true) if video mode is okay for graphics */
static int check_mode()
{
switch(mode=get_mode())
{
case CO320:
case BW320:
num_colors=4;
num_cols=320;
break;
case BW640:
num_colors=2;
num_cols=640;
break;
default:
return 0; /* not in video mode */
}
return 1;
}

void rxdraw(x1, y1, x2, y2, color) int x1,y1,x2,y2; unsigned char color;
{
if (!check_mode()) return;
x1%=num_cols;
y1%=num_rows;
x2%=num_cols;
y2%=num_rows;
color%=num_colors;
#ifdef BIOS
draw_line(x1,y1,x2,y2,color);
#else
if (mode==BW640) draw_line_640(x1,y1,x2,y2,color);
else draw_line_320(x1,y1,x2,y2,color);
#endif
}

void rx_put_dot(row,col,color) int row, col; char color;
{
if (!check_mode()) return;
row%=num_cols;
col%=num_rows;
color%=num_colors;
#ifdef BIOS
put_dot(row,col,color);
#else
if (mode==BW640) put_dot_640(row,col,color);
else put_dot_320(row,col,color);
#endif
}

int rx_get_dot(row,col) int row,col;
{
if (!check_mode()) return;
row%=num_cols;
col%=num_rows;
#ifdef BIOS
return get_dot(row,col);
#else
if (mode==BW640) return get_dot_640(row,col);
else return get_dot_320(row,col);
#endif
}