unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, pngimage, GR32_PNG, GR32, GR32_Image, ExtCtrls, StdCtrls,
MPlayer, Unit2, Unit3;
const
Bpp = Graphics.pf32bit;
type
TForm1 =
class(TForm)
MediaPlayer1: TMediaPlayer;
MediaPlayer2: TMediaPlayer;
Panel1: TPanel;
Timer1: TTimer;
Timer2: TTimer;
MediaPlayer3: TMediaPlayer;
MediaPlayer4: TMediaPlayer;
procedure FormCreate(Sender: TObject);
procedure MediaPlayer1Notify(Sender: TObject);
procedure MediaPlayer2Notify(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormKeyPress(Sender: TObject;
var Key: Char);
procedure Timer2Timer(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Overlay: TBitmap32;
Situation: Integer;
Alpha: Boolean;
OutlinePNG:
String;
implementation
{$R *.dfm}
function ChangeRes(X, Y: Integer; Frequency: Byte; FullScreen: Boolean): Boolean;
var
DevMode: TDeviceMode;
begin
// Initialisieren
EnumDisplaySettings(
nil, 0, DevMode);
DevMode.dmFields := DM_PELSWIDTH
or DM_PELSHEIGHT
or DM_DISPLAYFREQUENCY;
DevMode.dmDisplayFrequency := Frequency;
DevMode.dmPelsWidth := X;
DevMode.dmPelsHeight := Y;
// Auflösung ändern
if FullScreen
then
Result := ChangeDisplaySettings(DevMode, CDS_FULLSCREEN) = DISP_CHANGE_SUCCESSFUL
else
Result := ChangeDisplaySettings(DevMode, 0) = DISP_CHANGE_SUCCESSFUL;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.DoubleBuffered := true;
MediaPlayer1.DoubleBuffered:=true;
MediaPlayer2.DoubleBuffered:=true;
MediaPlayer3.DoubleBuffered:=true;
MediaPlayer4.DoubleBuffered:=true;
Panel1.DoubleBuffered:=true;
If not ChangeRes(800, 600, 0, True)
then
begin
MessageBox(0,
'
Das Ändern der Auflösung ist fehlgeschlagen.',
'
Fehler:', MB_OK
or MB_ICONERROR);
Exit;
end;
Form1.WindowState := wsMaximized;
MediaPlayer1.FileName:='
Videos\01.avi';
MediaPlayer1.open;
MediaPlayer1.Display:=Panel1;
MediaPlayer1.DisplayRect:=Panel1.ClientRect;
MediaPlayer2.FileName:='
Videos\02.avi';
MediaPlayer2.open;
MediaPlayer2.Display:=Panel1;
MediaPlayer2.DisplayRect:=Panel1.ClientRect;
MediaPlayer1.Play;
Situation:=1;
end;
procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin
if MediaPlayer1.Position = MediaPlayer1.Length
then begin
MediaPlayer2.Play;
end;
end;
procedure TForm1.MediaPlayer2Notify(Sender: TObject);
begin
if MediaPlayer2.Position = MediaPlayer2.Length
then begin
MediaPlayer2.Play;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var i:Integer;
LPNG: TPNGObject;
begin
for i:=0
to 100
do
begin
Form2.AlphaBlendValue:=i;
if i=100
then
begin
Timer1.Enabled:=false;
OutlinePNG:=GetCurrentDir() + '
\outline.png';
//GR32_PNG.LoadBitmap32FromPNG(Form3.Image321.Bitmap, OutlinePNG, Alpha);
//GR32_PNG.LoadPNGintoBitmap32(Form3.Image321.Bitmap, OutlinePNG, Alpha);
//Form3.Image321.Bitmap.DrawMode:=dmBlend;
LPNG := TPNGObject.Create;
try
LPNG.LoadFromFile('
outline.png');
Form3.Image1.Picture.Graphic:=LPNG;
finally
LPNG.Free;
end;
Form3.AlphaBlend := true;
Form3.AlphaBlendValue := 0;
Form3.Show;
Timer2.Enabled:=true;
end;
end;
end;
procedure TForm1.FormKeyPress(Sender: TObject;
var Key: Char);
begin
if Situation=1
then
begin
Form2.AlphaBlend := true;
Form3.AlphaBlend := true;
Form2.AlphaBlendValue := 0;
Form2.Show;
Timer1.Enabled := true;
end;
if Situation=2
then
begin
MediaPlayer3.Stop;
MediaPlayer3.Rewind;
MediaPlayer4.FileName:='
Videos\04.avi';
MediaPlayer4.open;
MediaPlayer4.Display:=Panel1;
MediaPlayer4.DisplayRect:=Panel1.ClientRect;
MediaPlayer4.Play;
end;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
var i: Integer;
begin
for i:=0
to 255
do
begin
Form3.AlphaBlendValue:=i;
if i=255
then
begin
Timer2.Enabled:=false;
end;
end;
end;
end.