unit NewUnit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Image1: TImage;
    procedure Button2KeyPress(Sender: TObject; var Key: Char);
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  x, y: integer;
  PressedChar: char;
  pressed: boolean = false;

implementation

uses
  MyCRT, RogueLabGen, start;

{$R *.dfm}

procedure TForm1.Button2KeyPress(Sender: TObject; var Key: Char);
begin
  PressedChar := Key;
  pressed := true;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Form1.Image1.Canvas.Font.Name := 'Lucida Console';
  Form1.Image1.Canvas.Font.Size := 8;
  Form1.Image1.Canvas.Font.Color := clWhite;
  Form1.Image1.Canvas.Brush.Color := clBlack;
  ClrScr;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  button1.Enabled := false;
  StartGame;
  Form1.Close;
end;

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (key = VK_RETURN) then
  begin
    PressedChar := #13;
    pressed := true;
  end
  else if (key = VK_ESCAPE) then
  begin
    PressedChar := #27;
    pressed := true;
  end
  else if (key = VK_BACK) then
  begin
    PressedChar := #8;
    pressed := true;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  SaveToFile('C:\temp.txt');
end;

end.

