Getting the resolution of the Desktop

Started by
6 comments, last by Zimans 22 years, 3 months ago
My game that I am working on is designed to run in a window. I''ve designed it so far with 800x600 as the minimum resolution that it runs in since anything smaller and the window does not fit (It is 660x550) However, what I would like to be able to do is determine the resolution of the desktop, and if it is smaller than 800x600, create the window as a smaller size, continue to render at my default resolution, but have ddraw squish the backbuffer when it copies it to the foreground. I don''t expect that many people are still running 640x480 as a desktop resolution, but since it would be an easy thing to implement I figure why not.. -Nate
Advertisement
If you want the current resolution use GetSystemMetrics. It''s part of the Win32 API.

[Resist Windows XP''s Invasive Production Activation Technology!]
More specifically use GetSystemMetrics(SM_CXSCREEN) to get an int value of the width of the screen and GetSystemMetrics(SM_CYSCREEN) returns the height of the screen.

By the way, I still do have 640x480 screen resolution. Reason: an old monitor and graphics card that can''t display 24-bit colors when using a larger resolution. Please keep all of us guys with old stuff in mind when developing your games (please)
-------------------------------------------------------BZZZZTT - CRASH - BANG"What was that?!""Captain, it appears that we have encountered a strange sub-space anomaly. I'm getting a high reading of tracheons beams. The anomaly seems to be some kind of rift in the space-time continuum. -- Never mind, Bones was just using the microwave again."
BTW its best to do this before creating any DX stuff, since if you do it while you are in fullscreen mode it will report back the res your DX fullscreen stuff is running in.

[The views stated herein do not necessarily represent the view of the company Eurocom ]

Eurocom Entertainment Software
www.Eurocom.co.uk

The Jackal
Alternatively:

IDirect3D8::GetAdapterDisplayMode

can be called before you create a device to get the desktop mode for a particular adapter. This method also has the benefit that its the easiest way correct mode for the adapter for each monitor in a multi monitor system.

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Mark Duffil, are you part of the PSX development department of Eurocom?

-----------------------------
The sad thing about artificial intelligence is that it lacks artifice and therefore intelligence.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
These posts made me think of something else i''ve never encountered before... What happens when you drag a DX window from one monitor to another.. I don''t have a multi-monitor setup, although I wish I did, and can''t test this...

-Nate
quote:Original post by Zimans
These posts made me think of something else i''ve never encountered before... What happens when you drag a DX window from one monitor to another.. I don''t have a multi-monitor setup, although I wish I did, and can''t test this...

-Nate



IIRC the rendering takes place on the adapter of the monitor the device was created for. The rendered output is then copied with a software blit (e.g. GDI style) to the monitor you dragged onto.

That''s definately what happens when the window straddles the boundary between two monitors, and I''m pretty sure its what happens when you drag across totally.

Then again having said that, most applications which do 3D don''t need that functionality. And if you did need that functionality you could quite easily respond to the Windows message when the window gets its new size by calling MonitorFromWindow() then re-creating the device for that window.

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

This topic is closed to new replies.

Advertisement