Results 1 to 5 of 5

Thread: Restoring fullscreen mode

  1. #1

    Restoring fullscreen mode

    Hello!

    I have a fullscreen app in DX9 (Clootie's Headers), and I switch to the desktop, but when going back to the app it doesn't show in fullscreen mode anymore. What can I do? Probably this is an old question...

  2. #2

    Restoring fullscreen mode

    Hi!

    I had the same problem before. I am using Omage Headers based on Clooties DX9 headers.

    In application.restore you do have to do something.
    When using Omega Headers it is an OmegaScreen.Reinit. Then it works perfect.

    This is a large function, I cannot tell you which parts of it belong in the Application.Restore, which not. But then it is working.

    I can post the functions code here (Reinit) if you want me to.

    Firle

  3. #3

    Restoring fullscreen mode

    I can post the functions code here (Reinit) if you want me to.
    Yes, please!

  4. #4

    Restoring fullscreen mode

    Hi!

    I only used DX9 headers from Clootie together with Omega Headers, so I am not sure what you have to do. OmegaScreen is a class and I call this method in Application.Restore then it works. I guess you will need parts of it, others not.

    function TOmegaScreen.ReInit: HRESULT;
    var
    hr: HRESULT;
    fsok: boolean;
    d3ddm: TD3DDisplayMode;
    behave: cardinal;
    pool: TD3DPOOL;
    begin
    if not assigned(FDevice) then
    begin
    result := S_FALSE;
    exit
    end;
    CaptureRenderStates;
    SubUnInit;
    if vb <> nil then
    vb := nil;
    if assigned(FOnUnInit) then
    FOnUnInit(self);
    FDevice.SetTexture(0, nil);

    { if not FFullScreen then
    begin
    GetWindowRect(FhWnd, rcWindowBounds);
    SetWindowPos(FhWnd, HWND_NOTOPMOST,
    rcWindowBounds.left, rcWindowBounds.top,
    (rcWindowBounds.right - rcWindowBounds.left),
    (rcWindowBounds.bottom - rcWindowBounds.top),
    SWP_SHOWWINDOW);
    end;
    }
    fsok := false;
    if ((FWidth = 800) and (FHeight = 600)) or
    ((FWidth = 640) and (FHeight = 400)) or
    ((FWidth = 640) and (FHeight = 480)) or
    ((FWidth = 1024) and (FHeight = 76) or
    ((FWidth = 320) and (FHeight = 200)) or
    ((FWidth = 320) and (FHeight = 240)) or
    ((FWidth = 1280) and (FHeight = 1024)) then
    fsok := true;

    with FD3DDEVPPAR do
    begin
    Windowed := not FFullScreen;
    if FBBAccess then
    Flags := D3DPRESENTFLAG_LOCKABLE_BACKBUFFER
    else
    Flags := 0;
    if (not Windowed) then
    begin // FullScreen
    if not fsok then
    begin
    beep;
    BackBufferWidth := 800;
    BackBufferHeight := 600;
    end
    else
    begin
    BackBufferWidth := FWidth;
    BackBufferHeight := FHeight;
    end;
    if Fbpp = 16 then
    BackBufferFormat := D3DFMT_R5G6B5
    else
    BackBufferFormat := D3DFMT_A8R8G8B8;
    if FBBCount < 1 then
    FBBCount := 1;
    BackBufferCount := FBBCount;
    FullScreen_RefreshRateInHz := D3DPRESENT_RATE_DEFAULT;
    if FVSync then
    PresentationInterval := D3DPRESENT_INTERVAL_ONE
    else
    PresentationInterval := D3DPRESENT_INTERVAL_IMMEDIATE;
    end
    else
    begin // Windowed mode
    BackBufferWidth := FWidth;
    BackBufferHeight := FHeight;
    FD3D.GetAdapterDisplayMode(D3DADAPTER_DEFAULT, d3ddm);
    BackBufferFormat := d3ddm.Format;
    if FVSync then
    PresentationInterval := D3DPRESENT_INTERVAL_ONE
    else
    PresentationInterval := D3DPRESENT_INTERVAL_IMMEDIATE;
    FullScreen_RefreshRateInHz := 0;
    end;
    end;

    // Reset the device
    hr := FDevice.Reset(FD3DDEVPPAR);
    if (FAILED(hr)) then
    begin
    result := hr;
    exit;
    end;

    ShowCursor(FShowMouseCursor);

    if FPool = plDefault then
    begin
    behave := D3DUSAGE_WRITEONLY or D3DUSAGE_DYNAMIC;
    pool := D3DPOOL_DEFAULT;
    end
    else
    begin
    behave := D3DUSAGE_WRITEONLY;
    pool := D3DPOOL_MANAGED;
    end;
    FDevice.CreateVertexBuffer(sizeof(TOmegaVertex) * maxVertices,
    behave, OmegaVertexDef, pool, VB, nil);

    RestoreRenderStates;
    SubInit;
    if assigned(FOnInit) then
    FOnInit(self);
    result := S_OK;
    end;
    I am not sure if it helps. Perhaps if you're lucky and Clootie takes a look here, he can tell you what you need exactly.

    Firle

  5. #5

    Restoring fullscreen mode

    Oook, thanks. It seems to be calling the Reset method of the 3d device. I didn't know there was a Reset.

    Regards!

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
  •