unit unMain; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DXClass, DXDraws; type TfmMain = class(TDXForm) dxDraw: TDXDraw; dxTimer: TDXTimer; procedure dxTimerTimer(Sender: TObject; LagCount: Integer); procedure FormCreate(Sender: TObject); procedure dxDrawInitialize(Sender: TObject); procedure dxDrawFinalize(Sender: TObject); procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); private public end; var fmMain: TfmMain; implementation {$R *.dfm} procedure TfmMain.dxTimerTimer(Sender: TObject; LagCount: Integer); begin if not dxDraw.CanDraw then Exit; DXDraw.Surface.Fill(0); with dxDraw.Surface.Canvas do try Brush.Style := bsClear; Font.Color := clWhite; Font.Size := 30; Textout(30, 30, DateTimeToStr(Now)); TextOut(dxDraw.Surface.Width - 180, 30, Format('%d FPS', [dxTimer.FrameRate])); finally Release; end; dxDraw.Flip; end; procedure TfmMain.FormCreate(Sender: TObject); begin dxTimer.Interval := Round(1000 / 60); end; procedure TfmMain.dxDrawInitialize(Sender: TObject); begin dxTimer.Enabled := True; end; procedure TfmMain.dxDrawFinalize(Sender: TObject); begin dxTimer.Enabled := False; end; procedure TfmMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = VK_ESCAPE then Close; if (ssAlt in Shift) and (Key=VK_RETURN) then begin dxDraw.Finalize; if doFullScreen in DXDraw.Options then begin RestoreWindow; dxDraw.Cursor := crDefault; BorderStyle := bsSizeable; dxDraw.Options := dxDraw.Options - [doFullScreen]; end else begin StoreWindow; dxDraw.Cursor := crNone; BorderStyle := bsNone; dxDraw.Options := dxDraw.Options + [doFullScreen]; end; dxDraw.Initialize; end; end; end.