Results 1 to 3 of 3

Thread: Full screen issue

  1. #1

    Full screen issue

    If I use the Windowed mode, everything OK. But when I switch to full screen mode, several seconds later, the computer crashed! Not every time, but the frequency is very high. It's very strange. Could someone tell me the reason? Lifepower?;-)

    The Powerdraw initializing code here:

    // initialize powerdraw
    PowerDraw := TPowerDraw.Create(FVclForm);
    PowerDraw.Width := 640;
    PowerDraw.Height := 480;
    PowerDraw.BitDepth := bd32;
    PowerDraw.OnInitDevice := PowerDrawInitDevice;
    PowerDraw.OnDoneDevice := PowerDrawDoneDevice;
    PowerDraw.Initialize;
    ...

    And the full screen switch code here:

    procedure TDXApplication.FullScreen;
    begin
    // finalize video mode
    PowerDraw.DoneDevice;
    // switch windowed mode
    PowerDraw.Windowed := not PowerDraw.Windowed;
    // change border style
    if PowerDraw.Windowed then FVclForm.BorderStyle:= bsSingle
    else FVclForm.BorderStyle:= bsNone;
    // TForm tends to change its size
    FVclForm.ClientWidth := PowerDraw.Width;
    FVclForm.ClientHeight := PowerDraw.Height;
    // re-initialize video mode
    PowerDraw.InitDevice;
    end;

  2. #2

    Full screen issue

    Before the call to "DoneDevice" you should finalize all customly created fonts, textures, etc., and reinitialize them after the following call of InitDevice. Avoiding this might cause errors (failing to switch to full-screen, for instance, etc).

  3. #3

    Full screen issue

    But I've done this;(

    procedure TDXApplication.PowerDrawInitDevice(Sender: TObject; var ExitCode: Integer);
    begin
    if Imgs<>nil then Imgs.LoadFromVTDb(FVTDB);
    if fntDef<>nil then fntDef.LoadFromVTDb(FVTDB, FNT_DEF, PowerDraw.DefTextureFormat);
    if fntHnt<>nil then fntHnt.LoadFromVTDb(FVTDB, FNT_HNT, PowerDraw.DefTextureFormat);
    end;

    procedure TDXApplication.PowerDrawDoneDevice(Sender: TObject);
    begin
    if Imgs<>nil then Imgs.Finalize;
    if fntDef<>nil then fntDef.Finalize;
    if fntHnt<>nil then fntHnt.Finalize;
    end;

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •