Programming App to switch to full screen & change screen properties

Started by
3 comments, last by okonomiyaki 21 years, 10 months ago
Ok, so now I've learned a whole bunch of DirectX concepts and unique ways of rendering 3-dimensional environments. And then I played around with it until I felt like I had a really go grasp on it, so what now? I'm wondering how I force my application (currently windowed) to change the resolution of the monitor (go fullscreen) say to 800x600 and change all of the needed settings (say go from 32-bit color to 16-bit color) so that my game will continue on assuming the computer is working in a certain format. It's just the normal operation of games, but I couldn't figure out how to do it right. Are there basic functions that you call and things are done for you? I've looked around but the places I looked kind of skipped this part of the programming. To clarify.. How do I expand my game from windowed to full screen? Certainly it's more than just a few flags, and I'm wondering if there's a standard way of doing it. Thanks. Edit: I'm using DirectX 8.1. I know there are ways with and without DX. Which ones are best? Optimal? I'm a little confused on exactly how to do it and with what. [edited by - okonomiyaki on May 30, 2002 2:40:47 AM]
Advertisement
i''m currently in the same dilema. I could be wrong about some, most, or all of this but....

The window you render to must have the dwstyle parameter set to WS_EX_TOPMOST | WS_POPUP | WS_VISIBLE when you create it, and must be the width and height you want, also the x, and y parameters should be 0.

then you do all your directx code as normal, but when you declare your D3DPRESENT_PARAMETERS structure, you just set the BackBufferWidth and BackBufferHeight to the width and height you want. you also must set Windowed to false, set the FullScreen_RefreshRateInHz to D3DPRESENT_RATE_DEFAULT and set the FullScreen_PresentationInterval to D3DPRESENT_INTERVAL_ONE
Finally you must set the BackBufferFormat to an appropriate D3DFORMAT (see the directx documentation). Finally when you call CreateDevice it kicks it into full screen mode.

There are some problems however... not all cards support all resolutions with all back buffer formats. To find out what modes are supported is usually pretty painful. When i figure it out mabey i''ll write a decent tutorial
the sdk has examples on enumerating video modes and changing resolution. its pretty staright forward, though there are some gotchas to watch for. DONT even think about using any non directx methods for resolution changes when using directx for any rendering. you will merely create problems for yourself.

you DONT have a grasp on d3d8 yet. rendering triangles and changin renderstates is nice and all, but you should learn some of the basic concepts like enumeration of video modes and resolution changes. also understand that dx overrides normal windows graphics functions thus using non dx methods of changing resolution is VERY bad. in essence you would then be trying to create a fullscreen windowed app which is bad and less flexible then a true full screen exclusive app (since you must share the video device with all other runnign apps. in fullscreen exclusive mode (ie not windowed) you dont share the device at all).
I had just looked at a webpage before about a guy saying it was more efficient to set up the program full-screen and such without even touching DirectX yet, and then render. I thought that was REALLY fishy. I think you are definitely right, a person..

quote:
you DONT have a grasp on d3d8 yet


rofl, perhaps not I kinda did things out of order- I don''t know how to do the simplest things (like this) but I understand some complex methods and ways of creating games, and specifically how to do that. I just haven''t REALLY tested them out yet in accordance with doing things such as this. I need to play around with different flags and settings too to really understand what''s going on. but yeah..... maybe that was a stretch
Sounds like a lot of settings and flag changing, Black Sheep, more than I thought actually. I know there is a function on enumerating video modes- and it helped a little, but I couldn''t find everything in the SDK. I looked there a little bit (maybe not long enough). Are there specific examples on changing video modes, not just resolution? I''ll have to look more closely, thanks though. I see you changing the resolution in all those flags Black Sheep, but you know how to change like the color mode or something? It''s probably just a lot of parameter changes that I need to look up..
Look at the common files framework. There is good solid enumeration and resolution changing code there. It is in the SDK under the \DXSDK_DIR\samples\Multimedia\Common\


dankydoo

This topic is closed to new replies.

Advertisement