#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;
?????????????? }
?????? }
void p_pixel(int x,int y,unsigned int color)
?????? { video_buff[y*320+x]=color;
?????? }
?????? void s_square(int x,int y,int side,int color)
?????? {
?????????? h_line(x,x+side,y,color);
?????????? h_line(x,x+side,y+side,color);
?????????? v_line(y,y+side,x,color);
?????????? v_line(y,y+side,x+side,color);
?????? }
?????? void r_rectangle(int x1,int y1,int x2,int y2,int color)
?????? {
?????????? h_line(x1,x2,y1,color);
?????????? h_line(x1,x2,y2,color);
?????????? v_line(y1,y2,x1,color);
?????????? v_line(y1,y2,x2,color);
?????? }
?????? void fillRectangle(int x1,int y1,int x2,int y2,int color)
?????? {
???????? int i;
???????? for(i=y1;i<=y2;i++)
???????? {
???????????? h_line(x1,x2,i,color);
???????? }
?????? }
?????? void ground()??/*?-ía?ò*/
?????? { r_rectangle(104,20,207,190,7);
?????? }
?????? void delzx()??/*??′?3?è-oó£?é?3yè-í·*/
?????? { delay(1000);
?????????? s_square(x3,y3,5,0);
?????????? s_square(x3,y3-6,5,0);
?????????? x3=0;
?????????? y3=0;
?????? }
?????? void me()??/*?-3?×??o*/
?????? { int cas=0;
?????????? if(sxzy==18432)??/*è?1?°′é??ü£??ííùé?ò??ˉ*/
?????????????? { yy-=5;
?????????????????? if(yy < y1+30)
?????????????????????? yy+=5;
?????????????????? if(yy==12)
?????????????????????? yy=17;
?????????
|