user2306421
user2306421

Reputation: 103

Direct9.0 Window (Full screen runtime)

How do I perform a runtime fullscreen/ and window mode swap s

  1. UnregisterClass
  2. Free all the directX device
  3. Re- initlize all the wc class format
  4. Re- initlize all the direct stuff

However, there is two problem to it.

  1. I managed to create a new window but the old window is closed or deleted.
  2. The client of the new Window is black. Which mean that the direct didnt link to new client.

2nd)

Upvotes: 1

Views: 1226

Answers (1)

zdd
zdd

Reputation: 8757

No, you needn't to create a new window, just use the old one. basically you can call IDirect3DDevice9::Reset with the new presentation parameters. when entering full-screen mode, you need to do the following things.

  1. Set D3DPRESENT_PARAMETERS.Windowed = true
  2. Resize the backbuffer(we always set the backbuffer size as the rendering window size)
  3. Update projection matrix with the new aspect ratio(backbuffer width/backbuffer height)
  4. Release any explicit render targets, depth stencil surfaces, additional swap chains, state blocks, and D3DPOOL_DEFAULT resources associated with the device.
  5. Call IDirect3DDevice9::Reset() to enter full-screen mode.

Be careful that when your app enter full-screen mode, it will hanging all applications, including the development environment(such as Visual Studio). so you'd better take another monitor to do full-screen debugging.

Upvotes: 2

Related Questions