Problem mit Pascal...

Naturian

Grünschnabel
Hi ich habe hier folgendes problem:

Und zwar soll ich in dieses programm hier 2 weitere Button einfügen die jeweil auf einen klick der maustaste blinken also

Button I mit linksklick
Button II mit rechtklick

so das problem is ja nich den button die buttons zu erstellen sondern eher den bereich zu deklarieren das das programm weiß "okay er hat in dem bereich mit der linken geklickt, jetzt blinke"

Hier erstmal der Quelltext:

Code:
     program Maustest;
     uses Crt,Dos;
     var Regs:       Registers;
         abbruch:    boolean;
     
     procedure mausaktivieren;
     begin
     clrscr;
     regs.ax := 0; intr($33,regs);
     if regs.ax = 0 then
     write('Keine Maus installiert!')
     else
     regs.ax := 1;
     intr($33,regs);
     end;
     
     procedure test;
     begin
     gotoxy(1,1);
     write('X-Position:      Y-Position:    linke Taste:            rechte Taste:          ');
     textcolor(black);
     textbackground(lightgray);
     gotoxy(34,14);
     write('            ');
     gotoxy(34,15);
     write('    Ende    ');
     gotoxy(34,16);
     write('            ');
     textcolor(lightgray);
     textbackground(black);
     
     textcolor(black);
     textbackground(lightgray);
     gotoxy(63,14);
     write('            ');
     gotoxy(63,15);
     write('      II    ');
     gotoxy(63,16);
     write('            ');
     textcolor(lightgray);
     textbackground(black);
     
     textcolor(black);
     textbackground(lightgray);
     gotoxy(10,14);
     write('            ');
     gotoxy(10,15);
     write('      I     ');
     gotoxy(10,16);
     write('            ');
     textcolor(lightgray);
     textbackground(black);
     
     repeat
     delay(100);
     regs.ax := 3;
     intr($33,regs);
     gotoxy(13,1);
     write((regs.cx div 8) +1 :3);
     gotoxy(29,1);
     write((regs.dx div 8) +1 :3);
     gotoxy(45,1);
     if regs.bx and 1 = 1 then
     write      ('GEDRšCKT')
     else write ('         ');
     gotoxy(70,1);
     if regs.bx and 2 = 2 then
     write      ('GEDRšCKT')
     else write ('         ');
     gotoxy (80,25);
     if regs.bx and 2 = 2 then
     begin
     if ((((regs.cx div 8) +1) >33) and (((regs.cx div 8) +1) <46) and
     (((regs.dx div 8) +1) >13) and (((regs.dx div 8) +1) <17)) then
     begin
     gotoxy(23,12);
     write('Ende nur mit der linken Maustaste!');
     delay(1000);
     gotoxy(23,12);
     write('                                   ');
     end;
     end;
     if regs.bx and 1 = 1 then
     begin
     if ((((regs.cx div 8) +1) >33) and (((regs.cx div 8) +1) <46) and
     (((regs.dx div 8) +1) >13) and (((regs.dx div 8) +1) <17))
     then abbruch:= true;
     end;
     until abbruch = true;
     end;
     
     procedure mausdeaktivieren;
     begin
     regs.ax := 2;
     intr($33,regs);
     end;
     
     {Hauptprogramm:}
     begin
     mausaktivieren;
     test;
     mausdeaktivieren;
     clrscr;
     gotoxy(20,12);
     write('Danke f?r den Maustest! - Tsch?ss!');
     delay(2000);
     clrscr;
     end.

ich habe schon die zeilen der beiden button aufgeschrieben

if regs.bx and 1 = 1 then
if ((((regs.cx div 8) +1) >10) and (((regs.cx div 8) +1) <21) and
(((regs.dx div 8) +1) >13) and (((regs.dx div 8) +1) <17))

und
if regs.bx and 2 = 2 then
if ((((regs.cx div 8) +1) >10) and (((regs.cx div 8) +1) <21) and
(((regs.dx div 8) +1) >13) and (((regs.dx div 8) +1) <17))

und da fängt nun das wirkliche problem an.. und zwar weiß ich nich wie ich dem programm nun sage das die buttons blinken sollen, und wo ich das hinschreiben soll..

wäre cool wenn ihr mir helfen würdet

bye nat
 
Zuletzt bearbeitet:
Hast du das Problem mittlerweile gelöst? Wenn nicht, würde ich dir vorschlagen, dass du dich ein wenig mit deiner Programmstruktur beschäftigst und dann sagst, wo du nicht weiterkommst, denn so ganz allgemein, wie du die Frage stellst, müsste ich als Antwort einen halben Roman schreiben. Kannst es z.B. selbst probieren und dann sagen, wo es hakt, oder meinetwegen auch eine private msg schreiben.
-Gawayn
 
Falls Interesse besteht kann ich daheim mal nachschauen. Ich hab vor Jahren mal 'ne Unit fuer Maussteuerung unter TP geschrieben, groesstenteils in Assembler. Kann mal gucken, die muesste ich noch haben. Kann die ja dann mal posten.
 
hehe kannste ja machen ^^ nur ich hab ne frage... kann man richtige sounds in tp abspielen? also mp3 oder wav? die die vom mainboardlautsprecher sind sind eher bedürftig
 
Unter DOS kannst du die Ausgabe von echten Waveform-Sounds nur mit einer speziellen Ansteuerung der Soundkarte erreichen. Dazu musst du dich sehr gut mit der Hardware auskennen, also erstens der Soundkarte selbst, zweitens dem DMA-Controller und drittens den IRQs. Es gibt auch Soundunits, allerdings kann ich dir keine gute nennen. Außerdem gibt es heutzutage Probleme mit der Ansteuerung der Soundkarten von DOS aus, weil Windows XP dazwischenfunkt und die Karten heute nicht mehr unbedingt kompatibel mit den alten Standards sind. Ich habe vor einigen Jahren mit dem Soundblaster herumprogrammiert und weiß daher, was für Probleme auftreten -- programmier lieber unter Windows!
-Gawayn
 
Hier, wie angedroht, meine mouse-Unit.
mouse.pas:
Code:
{$O+,F+,G+}
UNIT Mouse;

INTERFACE
CONST lb= 1;
      rb= 2;
      mb= 4;
PROCEDURE InitMouse;
FUNCTION Button: BYTE;
FUNCTION ButtonPressed(button: BYTE): BOOLEAN;
FUNCTION ButtonReleased(button: BYTE): BOOLEAN;
PROCEDURE ShowMouse;
PROCEDURE HideMouse;
PROCEDURE SetTextPosition(x,y: BYTE);
PROCEDURE GetTextPosition(VAR x,y: BYTE);
PROCEDURE SetTextLimits(xmin,ymin,xmax,ymax: BYTE);
FUNCTION InText(xmin,ymin,xmax,ymax: BYTE): BOOLEAN;
PROCEDURE SetGraphPosition(x,y: WORD);
PROCEDURE GetGraphPosition(VAR x,y: WORD);
PROCEDURE SetGraphLimits(xmin,ymin,xmax,ymax: WORD);
FUNCTION InGraph(xmin,ymin,xmax,ymax: WORD): BOOLEAN;
PROCEDURE SetLightPen(pen: BOOLEAN);

IMPLEMENTATION
VAR shown: BOOLEAN;
PROCEDURE InitMouse; ASSEMBLER;
ASM
 mov ax,0
 int 33h
 mov shown,false
END;

FUNCTION Button: BYTE; ASSEMBLER;
ASM
 mov ax,3
 int 33h
 mov al,bl
END;

FUNCTION ButtonPressed(button: BYTE): BOOLEAN; ASSEMBLER;
ASM
 mov ax,3
 int 33h
 cmp bl,button
 jz @1
 mov al,false
 jmp @2
 @1:
 mov al,true
 @2:
END;

FUNCTION ButtonReleased(button: BYTE): BOOLEAN; ASSEMBLER;
ASM
 mov ax,3
 int 33h
 and bl,button
 jz @1
 mov al,false
 jmp @2
 @1:
 mov al,true
 @2:
END;

PROCEDURE ShowMouse; ASSEMBLER;
ASM
 cmp shown,true
 je @1
 mov ax,1
 int 33h
 mov shown,true
 @1:
END;

PROCEDURE HideMouse; ASSEMBLER;
ASM
 cmp shown,false
 je @1
 mov ax,2
 int 33h
 mov shown,false
 @1:
END;

PROCEDURE SetTextPosition(x,y: BYTE);
BEGIN
 SetGraphPosition((x-1)*8,(y-1)*8);
END;

PROCEDURE GetTextPosition(VAR x,y: BYTE);
VAR gx,gy: WORD;
BEGIN
 GetGraphPosition(gx,gy);
 ASM
  shr gx,3
  add gx,1
  shr gy,3
  add gy,1
  les di,x
  mov ax,gx
  mov es:[di],al
  les di,y
  mov ax,gy
  mov es:[di],al
 END;
END;

PROCEDURE SetTextLimits(xmin,ymin,xmax,ymax: BYTE);
BEGIN
 SetGraphLimits((xmin-1)*8,(ymin-1)*8,(xmax-1)*8,(ymax-1)*8);
END;

FUNCTION InText(xmin,ymin,xmax,ymax: BYTE): BOOLEAN;
VAR x,y: BYTE;
BEGIN
 GetTextPosition(x,y);
 IF (x IN [xmin..xmax]) AND (y IN [ymin..ymax]) THEN InText:=true
 ELSE InText:=false;
END;

PROCEDURE SetGraphPosition(x,y: WORD); ASSEMBLER;
ASM
 mov ax,4
 mov cx,x
 mov dx,y
 int 33h
END;

PROCEDURE GetGraphPosition(VAR x,y: WORD); ASSEMBLER;
ASM
 mov ax,3
 int 33h
 les di,x
 mov es:[di],cx
 les di,y
 mov es:[di],dx
END;

PROCEDURE SetGraphLimits(xmin,ymin,xmax,ymax: WORD);
BEGIN
 IF (xmax>xmin) THEN ASM
                      mov ax,7
                      mov cx,xmin
                      mov dx,xmax
                      int 33h
                     END;
 IF (ymax>ymin) THEN ASM
                      mov ax,8
                      mov cx,ymin
                      mov dx,ymax
                      int 33h
                     END;
END;

FUNCTION InGraph(xmin,ymin,xmax,ymax: WORD): BOOLEAN;
VAR x,y: WORD;
BEGIN
 GetGraphPosition(x,y);
 IF (x IN [xmin..xmax]) AND (y IN [ymin..ymax]) THEN InGraph:=true
 ELSE InGraph:=false;
END;

PROCEDURE SetLightPen(pen: BOOLEAN); ASSEMBLER;
ASM
 cmp pen,true
 jz @1
 cmp pen,false
 jz @2
 @1:
 mov ax,13
 int 33h
 jmp @3
 @2:
 mov ax,14
 int 33h
 jmp @3
 @3:
END;
END.
 

Neue Beiträge

Zurück