Sunday, October 3, 2010

BB, part 1

A minimal D3D:


uses
 BB.Input.Keys, BB.Screen.D3D, BB.Colors, BB.Screen.Types, BB.Screen;

procedure TForm1.FormActivate(Sender: TObject);
var
 gd: TGraphicDriver;

begin
 gd := TD3DDriver.Create;
 gd.WindowHandle := WindowHandle;
 gd.Width := Width;
 gd.Height := Height;
 gd.BPP := 32;
 gd.ScreenFlags := [sfClear, sfWait];
 gd.BackgroundColor := TRGB.Red.ToInt(32);
 gd.Initialize;

 repeat
  gd.BeginRender;
  try
     gd.Rectangle(0, 0, gd.CurrentFPS, 16, 1, TRGB.Green, TRGB.Yellow, False);
  finally
         gd.EndRender;
      end;
 until InKey(VK_ESCAPE);

 Close;
end;

end.

No comments:

Post a Comment