Hello there! I'm working at a new game and i have a little problem..

program MousTestProgram;

  uses Crt, Dos, Graph;
  var graphicsdriver,graphicsmode,errcode:integer;

  procedure ResetMouse;
  var regs : registers;
  begin
    FillChar (regs, SizeOf(regs), 0);
    regs.ax := $0000;
    Intr ($33, regs);
    if regs.ax <> $FFFF then begin
      writeln ('hardware/driver not installed');
      halt;
    end;
  end; (* ResetMouse *)

  procedure ShowMouseCursor;
  var regs : registers;
  begin
    FillChar (regs, SizeOf(regs), 0);
    regs.ax := $0001;
    Intr ($33, regs);
  end; (* ShowMouseCursor *)

  procedure HideMouseCursor;
  var regs : registers;
  begin
    FillChar (regs, SizeOf(regs), 0);
    regs.ax := $0002;
    Intr ($33, regs);
  end; (* HideMouseCursor *)

  procedure GetMouseCursor (var row, column, button : word);
  var regs : registers;
  begin
    FillChar (regs, SizeOf(regs), 0);
    regs.ax := $0003;
    Intr ($33, regs);
    row := regs.dx div 8;
    column := regs.cx div 8;
    button := regs.bx;
  end; (* GetMouseCursor *)

  procedure PutMouseCursor (row, column : word);
  var regs : registers;
  begin
    FillChar (regs, SizeOf(regs), 0);
    regs.ax := $0004;
    regs.dx := 8 * row;
    regs.cx := 8 * column;
    Intr ($33, regs);
  end; (* PutMouseCursor *)

  procedure TEST;
  var row, col, but : word;
  begin
    repeat
      GetMouseCursor (row, col, but);
      if (row>9) and (row<22) and (col>17) and (col<31) and ((but=1) or (but=2) or (but=3)) then
      begin line(170,100,230,160);
            line(170,160,230,100);       
      until KeyPressed;
  end;


procedure cage;
begin line(250,80,250,390);
      line(350,80,350,390);
      line(150,180,450,180);
      line(150,280,450,280)
end;

  begin
    graphicsdriver:=detect;
    initgraph(graphicsdriver,graphicsmode,'E:\BP\BGI');
    errcode:=graphresult;
    if graphresult<>grok then
    begin clrscr;
          writeln('ERROR ',grapherrormsg(errcode));
          writeln('noob');
          readln;
          halt(1);
    end
    else
    begin cage;
          ResetMouse;
          ShowMouseCursor;
          PutMouseCursor (12, 39);
          TEST;
          HideMouseCursor;
    end;
    closegraph
  end.  (* MousTestProgram *)

this is the code, and here's the problem: i press click somewhere near the x that'll be formed and i move the mouse it will leave space at the lines, and if i press again and again and again it won't leave a space again... so i want to know... what do i have to do at this program so that it won't leave a space if i press click near the x that'll be formed?

Recommended Answers

All 6 Replies

ok i've done it, now i have another problem:
whenever i give the exe to someone, that someone can't run it because of the graph which in my case is in e:/bp/bgi.... Is there any way that i can give him the graph.tpu and he can run the exe?
i tried to leave a blank instead of e:/bp/bgi and move the graph.tpu in the same folder with the exe but it doesn't work....

I use InitGraph(gD,gM,''); and then put the following files in the same directory as the [prog].exe or in a directory listed in the DOS Path environment string :

graph.tpu
egavga.bgi
[what_ever_chars_you_are_using].chr e.g. litt.chr

what files do i need to put near the exe so that the computers that doesn't have pascal, or doesn't have pascal with crt patch work?
and if the computer doesn't have pascal, are there any files needed to be near the exe for the dos unit?

how can i do two things in the same time, let's say for instance i want a move a ball and in the same time i want a song to be played and in the same time i move something.. i want only ideas not codes

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.