|
![]() | 作者: cenda [cenda]
![]() |
登录 |
我在VC6。0中运行程序时好几次都出现一个找不到graphics.h文件的错误,我在装好后的目录下也查找了,没有这个头文件。哪位高手帮帮忙帮我发一下这个文件,急用!~谢了。 |
地主 发表时间: 12/18 11:00 |
![]() | 回复: cenda [cenda] ![]() |
登录 |
没有人吗, 自己顶一下。 请有装的人帮忙找一下好吗,很多程序都要用到这个啊, 不然老是提示出错。 |
B1层 发表时间: 12/20 01:45 |
![]() | 回复: NetDemon [netdemon] ![]() |
登录 |
针对TC写的源程序不经修改是不能在VC中编译的 |
B2层 发表时间: 12/20 02:10 |
![]() | 回复: cenda [cenda] ![]() |
登录 |
这是源程序, 提示找不到 graphics.h这个头文件。 #include <stdio.h> #include <stdlib.h> #include <dos.h> #include <graphics.h> #include <conio.h> #include <math.h> #include "/BSC/bool.h" #include "/BSC/FPlane.h" #define bullets 150 class Spirit { public: char *image; char *mask; char *buffer; FPlane v; FPlane position; point oldPosition; void Restore(bool first=false); void Move(); void Store(); void DrawDirect(); void Draw(bool force=false); void (* OutofScreen)(Spirit *object); }; void Spirit::Restore(bool first) { if(!first) putimage(oldPosition.x, oldPosition.y, buffer, COPY_PUT); } void Spirit::Move() { int x, y; (position+=v).Project(x, y); if(x<0||y<0||x>639-(*((int *)(image)))||y>349-(*((int *)(image+2)))) { OutofScreen(this); return; } } void Spirit::Store() { int x, y; position.Project(x, y); getimage(x, y, x+(*((int *)image)), y+(*((int *)(image+2))), buffer); oldPosition.x=x; oldPosition.y=y; } void Spirit::DrawDirect() { int x, y; position.Project(x, y); putimage(x, y, mask, AND_PUT); putimage(x, y, image, OR_PUT); } void Spirit::Draw(bool force) { Restore(force); Move(); Store(); DrawDirect(); } volatile bool key_up; volatile bool key_down; volatile bool key_left; volatile bool key_right; volatile bool key_upleft; volatile bool key_upright; volatile bool key_downleft; volatile bool key_downright; Spirit *pPlane; char plane[]= { 0x0e, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 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x80, 0x02, 0x80, 0x02, 0x80, 0x02, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7e, 0xfc, 0x7e, 0xfc, 0x7e, 0xfc, 0x7e, 0xfc, 0x7e, 0xfc, 0x7e, 0xfc, 0x7e, 0xfc, 0x7e, 0xfc, 0x7e, 0xfc, 0x7e, 0xfc, 0x7e, 0xfc, 0x7e, 0xf8, 0x3e, 0xf8, 0x3e, 0xf8, 0x3e, 0xf8, 0x3e, 0xf0, 0x1e, 0xf0, 0x1e, 0xf0, 0x1e, 0xf0, 0x1e }; char bullet[]= { 0x03, 0x00, 0x03, 0x00, 0x60, 0x60, 0x00, 0x00, 0xf0, 0xf0, 0x60, 0x40, 0xe0, 0xf0, 0x60, 0x00, 0x40, 0x60, 0x00, 0x00 }; char bullet_mask[]= { 0x03, 0x00, 0x03, 0x00, 0x90, 0x90, 0x90, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90, 0x90, 0x90 }; char burn[]= { 0x0e, 0x00, 0x0e, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x05, 0x20, 0x00, 0x00, 0x00, 0x00, 0x54, 0xa8, 0x54, 0xa8, 0x04, 0x80, 0x04, 0x00, 0x0b, 0xc4, 0x0f, 0xe4, 0x0b, 0x40, 0x09, 0x00, 0xb7, 0xfc, 0xbf, 0xfc, 0x85, 0x9c, 0x00, 0x00, 0x5f, 0xf4, 0x5f, 0xfc, 0x57, 0xd0, 0x16, 0x80, 0x5f, 0xf8, 0x5f, 0xf8, 0x17, 0xe0, 0x04, 0x00, 0xdf, 0x98, 0xdf, 0xf8, 0x0f, 0x98, 0x01, 0x80, 0x3e, 0xfc, 0x3f, 0xfc, 0x2a, 0xd0, 0x02, 0x00, 0x3f, 0xaa, 0x3f, 0xfe, 0x17, 0xa0, 0x02, 0x00, 0x6b, 0x54, 0x7f, 0xfc, 0x03, 0x44, 0x00, 0x00, 0x1f, 0xc4, 0x1f, 0xd4, 0x09, 0x00, 0x00, 0x00, 0x13, 0x10, 0x17, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x02, 0xa0, 0x00, 0x00, 0x00, 0x00 }; char burn_mask[]= { 0x0e, 0x00, 0x0e, 0x00, 0xfd, 0xfe, 0xfd, 0xfe, 0xfd, 0xfe, 0xfd, 0xfe, 0xff, 0xbe, 0xff, 0xbe, 0xff, 0xbe, 0xff, 0xbe, 0xfa, 0xde, 0xfa, 0xde, 0xfa, 0xde, 0xfa, 0xde, 0xab, 0x56, 0xab, 0x56, 0xab, 0x56, 0xab, 0x56, 0xf0, 0x1a, 0xf0, 0x1a, 0xf0, 0x1a, 0xf0, 0x1a, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0xa0, 0x02, 0xa0, 0x02, 0xa0, 0x02, 0xa0, 0x02, 0xa0, 0x06, 0xa0, 0x06, 0xa0, 0x06, 0xa0, 0x06, 0x20, 0x06, 0x20, 0x06, 0x20, 0x06, 0x20, 0x06, 0xc0, 0x02, 0xc0, 0x02, 0xc0, 0x02, 0xc0, 0x02, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0x80, 0x02, 0x80, 0x02, 0x80, 0x02, 0x80, 0x02, 0xe0, 0x2a, 0xe0, 0x2a, 0xe0, 0x2a, 0xe0, 0x2a, 0xe8, 0x0e, 0xe8, 0x0e, 0xe8, 0x0e, 0xe8, 0x0e, 0xfd, 0x5e, 0xfd, 0x5e, 0xfd, 0x5e, 0xfd, 0x5e }; void interrupt (*oldhandler)(...); void interrupt handler(...) { signed char key; unsigned int i; key=inportb(0x60); bool value=true; if(key<0) value=false; switch(key&0x7f) { case 71: key_upleft=value; break; case 72: key_up=value; break; case 73: key_upright=value; break; case 79: key_downleft=value; break; case 80: key_down=value; break; case 81: key_downright=value; break; case 75: key_left=value; break; case 77: key_right=value; break; } oldhandler(); } void InitBullet(Spirit &object) { int x, y; switch(rand()%4) { case 0: x=0; y=rand()%346; break; case 1: x=635; y=rand()%346; break; case 2: x=rand()%636; y=0; break; case 3: x=rand()%636; y=345; break; } object.position.Unproject(x, y); if(rand()%10==0) { object.v.setTheta(rand()%360, Angle_Geometry, Angle_Degree); object.v.setRho(7); } else { object.v=pPlane->position-object.position; float x=pi*(rand()%100+100)/400.0; object.v.setRho(4+2*pow(sin(x), 20)); } } void BulletOut(Spirit *object) { object->Restore(); InitBullet(*object); } void PlaneOut(Spirit *object) { int x, y; object->position.Project(x, y); if(x<0) x=0; if(y<0) y=0; if(x>639-(*((int *)object->image))) x=638-(*((int *)object->image)); if(y>349-(*((int *)(object->image+2)))) y=348-(*((int *)(object->image+2))); object->v.setRho(0); object->position.Unproject(x, y); } void main() { bool Odd; int hund; float seconds; if(registerbgidriver(EGAVGA_driver)<0) return; oldhandler=getvect(0x09); setvect(0x09, handler); randomize(); int gdriver=VGA, gmode=VGAMED; initgraph(&gdriver, &gmode, ""); char key; do { setactivepage(1); cleardevice(); setactivepage(0); cleardevice(); Odd=true; for(int i=0; i<200; i++) { int x, y, c; setactivepage(0); putpixel(x=rand()%640, y=rand()%350, c=rand()%16); setactivepage(1); putpixel(x, y, c); } char plane_buffer[124]; Spirit Plane; Plane.image=plane; Plane.mask=plane_mask; Plane.buffer=plane_buffer; Plane.OutofScreen=PlaneOut; pPlane=&Plane; Plane.position.OffsetX()=313; Plane.position.OffsetY()=168; Spirit Bullet[bullets]; char bullet_buffer[bullets][20]; for(i=0; i<bullets; i++) { Bullet[i].image=bullet; Bullet[i].mask=bullet_mask; Bullet[i].buffer=bullet_buffer[i]; Bullet[i].image=bullet; Bullet[i].OutofScreen=BulletOut; Bullet[i].position.OffsetX()=318; Bullet[i].position.OffsetY()=173; InitBullet(Bullet[i]); Bullet[i].Store(); } Plane.Store(); Plane.DrawDirect(); setvisualpage(1); getch(); seconds=0; setactivepage(0); for(;;) { struct time t; do { gettime(&t); if(kbhit()) if(getch()==13) do;while(getch()!=13); } while(hund/5==t.ti_hund/5); hund=t.ti_hund-hund; while(hund<0)hund+=100; seconds+=hund/100.0; hund=t.ti_hund; Plane.v.setRho(0); if(key_up) Plane.v.setY(Plane.v.getY()+1); if(key_down) Plane.v.setY(Plane.v.getY()-1); if(key_left) Plane.v.setX(Plane.v.getX()-1); if(key_right) Plane.v.setX(Plane.v.getX()+1); if(key_upleft) { Plane.v.setX(Plane.v.getX()-sqrt(2)/2); Plane.v.setY(Plane.v.getY()+sqrt(2)/2); } if(key_upright) { Plane.v.setX(Plane.v.getX()+sqrt(2)/2); Plane.v.setY(Plane.v.getY()+sqrt(2)/2); } if(key_downleft) { Plane.v.setX(Plane.v.getX()-sqrt(2)/2); Plane.v.setY(Plane.v.getY()-sqrt(2)/2); } if(key_downright) { Plane.v.setX(Plane.v.getX()+sqrt(2)/2); Plane.v.setY(Plane.v.getY()-sqrt(2)/2); } if(Plane.v.getRho()>0) Plane.v.setRho(4); if(kbhit()) if(getch()==27) break; Plane.Move(); for(i=0; i<bullets; i++) { Bullet[i].Move(); if((Bullet[i].position-Plane.position).getRho()<7) break; } if(i<bullets) { setactivepage(Odd); Plane.Restore(); int x, y; Plane.position.Project(x, y); putimage(x, y, burn_mask, AND_PUT); putimage(x, y, burn, OR_PUT); break; } for(i=0; i<bullets; i++) Bullet[i].DrawDirect(); Plane.DrawDirect(); setactivepage(Odd); setvisualpage(Odd=!Odd); for(i=0; i<bullets; i++) Bullet[i].Restore(); Plane.Restore(); for(i=0; i<bullets; i++) Bullet[i].Store(); Plane.Store(); } char sbuffer[100]; sprintf(sbuffer, "%3.2f seconds!", seconds); outtextxy(280, 150, sbuffer); do key=getch(); while(key!=27&&key!=13); } while(key!=27); closegraph(); setvect(0x09, oldhandler); } |
B3层 发表时间: 12/20 12:17 |
![]() | 回复: tabris17 [tabris17] ![]() |
登录 |
这个程序要用TC++来编译 |
B4层 发表时间: 12/20 18:26 |
![]() | 回复: cenda [cenda] ![]() |
登录 |
不能用VC吗, 唉, 真不幸, 我没有装TV啊。 没有其它的办法了吗? |
B5层 发表时间: 12/21 00:19 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号