分类:
2008-10-15 16:40:18
#include "graphics.h"
#include "bios.h"
#include "conio.h"
#include "stdlib.h"
#include "dos.h"
#define UP 0x4800
#define DOWN 0x5000
#define LEFT 0x4600
#define RIGHT 0x4d00
#define ESC 0x0016
#define VGA256 0x13
#define TEXT 0x03
int x,y,l,sxzy=0,zx=0,xx=5,yy=167;
int x1=5,y1=3,x3=0,y3=0,x4=0,y4=0;
int youlife=50,mylife=30;
int board[100][170];
unsigned char far *video_buff=(char far *)0xA0000000L;
void setvideomode(int mode)
{ union REGS inregs,outregs;
inregs.h.ah=0;
inregs.h.al=(unsigned char)mode;
int86(0x10,&inregs,&outregs);
}
void v_line(int y0,int y1,int x,unsigned int color)
{ unsigned int address,n,temp;
address=320*y0+x;
for(n=0;n<=y1-y0;n++)
{
if(y0>y1)
{
temp=y1;
y1=y0;
y0=temp;
}
video_buff[address]=color;
address+=320;
}
}
void h_line(int x0,int x1,int y,unsigned int color)
{ unsigned int address,n,temp;
address=320*y+x0;
for(n=0;n<=x1-x0;n++)
{
if(x0>x1)
{
temp=x1;
x1=x0;
x0=temp;
}
video_buff[address]=color;
address+=1;
}
}
[1]