FullScr: Delphi Version
{*****************************************************************************
* *
* FullScr.dpr *
* FullScrU.pas *
* *
* This is a version of the first Fastgraph for Windows example program *
* modified for use as a DirectDraw full screen application. *
* *
*****************************************************************************}
unit FullscrU;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, FGWinD;
type
TForm1 = class(TForm)
procedure AppOnActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormPaint(Sender: TObject);
procedure FormDestroy(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
const
vbWidth = 640;
vbHeight = 480;
var
dc : hDC;
hPal : hPalette;
hVB : integer;
procedure TForm1.AppOnActivate(Sender: TObject);
begin
fg_realize(hPal);
Invalidate;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
fg_ddsetup(vbWidth,vbHeight,8,FG_DX_BLIT);
dc := GetDC(Form1.Handle);
fg_setdc(dc);
hPal := fg_defpal;
fg_realize(hPal);
Visible := True;
fg_vbinit;
hVB := fg_vballoc(vbWidth,vbHeight);
fg_vbopen(hVB);
fg_vbcolors;
fg_setcolor(19);
fg_fillpage;
fg_mouseini;
fg_mousevis(0);
Application.OnActivate := AppOnActivate;
end;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key = VK_Escape) or (Key = VK_F12) then Close;
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
fg_vbpaste(0,vbWidth-1,0,vbHeight-1,0,vbHeight-1);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
fg_mousevis(1);
fg_vbclose;
fg_vbfree(hVB);
fg_vbfin;
DeleteObject(hPal);
ReleaseDC(Form1.Handle,dc);
Application.Minimize;
end;
end.
|