unit t_steuer;

interface

uses crt, graph;

{----------------------------------------------------------------------------}

procedure steinauswahl;

function aussetzen : boolean;

procedure steinlegen(var setzt: boolean);

procedure steindrehen;

procedure maussteuer(x, y, tastged: word; var setzt : boolean);

{****************************************************************************}

implementation

type akt_typ = 1..2;

const links = 1;
      rechts= 2;

procedure cursor(akt_nr: akt_typ);

  begin
    if akt_nr=1 then
      begin
      end;
    if akt_nr=2 then
      begin
      end;
  end;

{----------------------------------------------------------------------------}

function aussetzen : boolean;

  begin
    aussetzen:=true;
  end;

{----------------------------------------------------------------------------}

procedure steindrehen;
  begin
  end;

{----------------------------------------------------------------------------}

procedure steinlegen(var setzt : boolean);

  begin
    setzt:=true;
  end;

{----------------------------------------------------------------------------}

procedure steinauswahl;

  var ch : char;
      gewaehlt : boolean;

  begin
    repeat
      ch:=readkey;
      case ch of
          chr(0)  : begin
                      ch:=readkey;
                      case ord(ch) of
                          75 : cursor(links);
                          77 : cursor(rechts);
                        end {of case ord(ch)} ;
                     end {of begin chr(0)} ;
          chr(8)  : gewaehlt:=true;
          chr(13) : gewaehlt:=true;
        end {of ch};
    until gewaehlt=true;
  end;

{----------------------------------------------------------------------------}

procedure linkspfeil;
  begin
    setviewport(0, 418, 35, 455, true);
    clearviewport;
    setviewport(0, 0, 639, 479, true);
    setlinestyle(0, 1, 2);
    setcolor(white);
    line(4, 437, 14, 419);
    line(14, 419, 14, 429);
    line(14, 429, 34, 429);
    line(34, 429, 34, 444);
    line(34, 444, 14, 444);
    line(14, 444, 14, 454);
    line(14, 454, 4, 437);
  end;

function inrecht(x1, y1, x2, y2, xs, ys : integer) : boolean;

  var statbo : boolean;

  begin
    statbo:=(xs>x1) and (ys>y1) and (xs<x2) and (ys<y2);
    if statbo then inrecht:=true;
  end;

procedure maussteuer(x, y, tastged: word; var setzt: boolean);

  begin
    setzt:=false;
    if tastged=1 then
      if inrecht(315, 404, 445, 439, x, y)=true then steinlegen(setzt);
    if tastged=1 then
      if inrecht(450, 404, 580, 439, x, y)=true then steindrehen;
    if tastged=1 then
      if inrecht(315, 444, 445, 477, x, y)=true then setzt:=true;
    if tastged=1 then
      if inrecht(450, 444, 580, 477, x, y)=true then steinauswahl;
  end;

{----------------------------------------------------------------------------}

end.