unit test;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TransparentPanel, ExtCtrls, StdCtrls, MPlayer, jpeg, gifimage,
  pngimage;

type
  TForm1 = class(TForm)
    TransparentPanel1: TTransparentPanel;
    Button1: TButton;
    Image1: TImage;
    MediaPlayer1: TMediaPlayer;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Panel2: TPanel;
    Bevel1: TBevel;
    inventar1: TMediaPlayer;
    Image2: TImage;
    Image3: TImage;
    Edit1: TEdit;
    Button5: TButton;
    Button6: TButton;
    Image4: TImage;
    procedure Button3Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure MediaPlayer1Notify(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Panel2DragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure FormActivate(Sender: TObject);
    procedure inventar1Notify(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure Button6Click(Sender: TObject);
  private
    procedure isensorEndDrag(Sender, Target: TObject; X, Y: Integer);
    procedure isensorMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

var
 isensor:TImage;
 inventar:TTransparentpanel;

implementation

{$R *.dfm}

procedure TForm1.Button3Click(Sender: TObject);
begin
 mediaplayer1.FileName:='resources\music\b.avi';
 mediaplayer1.Open;
 mediaplayer1.play;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 mediaplayer1.stop;
 mediaplayer1.Close;
 mediaplayer1.FileName:='resources\music\c.avi';
 mediaplayer1.open;
 mediaplayer1.Notify:=true;
 mediaplayer1.Play;
end;

procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin
  if MediaPlayer1.NotifyValue=nvSuccessful then
  begin
    MediaPlayer1.Play;
    MediaPlayer1.Notify := True;
  end
 {if mediaplayer1.Notify = True then
   begin
    mediaplayer1.Play;
   end
 else
   begin
    mediaplayer1.Stop;
   end }
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
 isensor:=TImage.Create(self);
 isensor.Parent := inventar1;
 isensor.Left := 0;
 isensor.Top := 0;
 isensor.Width:=145;
 isensor.Height:=137;
 isensor.OnEndDrag:=isensorEndDrag;
 isensor.OnMouseDown:=isensorMouseDown;
end;

procedure TForm1.isensorEndDrag(Sender, Target: TObject; X, Y: Integer);
begin
 if (Target = panel2) then
  begin
   close;
  end
end;

procedure TForm1.isensorMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
 if Button = mbLeft then isensor.BeginDrag(False);
end;

procedure TForm1.Panel2DragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
 if (Source = isensor) then Accept := True else Accept:=false;
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
 {inventar:=TTransparentPanel.Create(self);
 inventar.Parent := Self;
 inventar.Left := 0;
 inventar.Top := 0;
 inventar.Width:=50;
 inventar.Height:=50;

 inventar1.FileName:='resources\inv\star.avi';
 inventar1.Open;
 inventar1.Display:=inventar;
 inventar1.DisplayRect:=inventar.ClientRect;
 inventar1.play;}
end;

procedure TForm1.inventar1Notify(Sender: TObject);
begin
if inventar1.NotifyValue=nvSuccessful then
  begin
    inventar1.Play;
    inventar1.Notify := True;
   end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 image2.free;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
 edit1.text:=edit1.text+'1';
end;

procedure TForm1.Edit1Change(Sender: TObject);
begin
 if edit1.text='111' then close;
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
 mediaplayer1.Pause;
end;

end.
