为什么琴盘不能和鼠标同时出现在屏幕上呢,请帮忙看一下哪里出错了 #include"graphics.h" #include"stdlib.h" #include"dos.h" #define LEFTPRESS 0xff01 #define LEFTCLICK 0xff10 #define LEFTDRAG 0xff19 #define MOUSEMOVE 0xff08 int MouseExist; int MouseButton; int MouseX; int MouseY; void MouseOn(void); void MouseOff(void); int leftPress(void); int Rightpress(void); void MouseGetXY(void); void Play(void); void Init(void); void main() {Init(); Play(); } void MouseOn(void) { _AX=0x01; geninterrupt(0x33); } void MouseSetXY(int x,int y) { _CX=x; _DX=y; _AX=0x04; geninterrupt(0x33); } int LeftPress(void) { _AX=0x03; geninterrupt(0x33); return(_BX&1); } intRightPress(void) { _AX=0x03; geninterrupt(0x33); return(_BX&2); } void MouseGetXY(void) { _AX=0x03; geninterrupt(0x33); MouseX=_CX; MouseY=_DX; } void Init(void) {int graphdriver=VGA; int graphmode=VGAHI; int i,j; initgraph(&graphdriver,&graphmode,""); cleardevice(); MouseSetXY(50,220); MouseX=50; MouseY=220; setbkcolor(0); setcolor(3); for(i=0;i<50;i+=7) {line(56+12*i,200,56+12*i,300); line(20+12*i,200,20+12*i,300); } rectangle(20,200,12*49+20,300); setfillstyle(SOLID_FILL,1);
for(i=0;i<49;i+=7) {rectangle(28+12*i,200,36+12*i,250); floodfill(31+12*i,210,3); line(32+12*i,250,32+12*i,300); rectangle(40+12*i,200,48+12*i,250); floodfill(45+12*i,210,3); line(44+12*i,250,44+12*i,300); } for(j=0;j<49;j+=7) {rectangle(64+12*j,200,72+12*j,250); floodfill(70+12*j,210,3); line(68+12*j,250,68+12*j,300); rectangle(76+12*j,200,84+12*j,250); floodfill(80+12*j,210,3); line(92+12*j,250,92+12*j,300); rectangle(88+12*j,200,96+12*j,250); floodfill(90+12*j,210,3); line(80+12*j,250,80+12*j,300); } setcolor(4); circle(278,280,2); MouseOn(); getch(); closegraph(); } void Play(void) {MouseOn(); while(!kbhit()) {if(LeftPress()) {MouseGetXY(); if(MouseX>20&&MouseX<500&&MouseY>20&&MouseY<300) {sound(492); delay(3000000); nosound(); }
} } }
----------------解决方案--------------------------------------------------------
这么长连个注释都没有..........
----------------解决方案--------------------------------------------------------