Archived

This topic is now archived and is closed to further replies.

Zimans

Getting the resolution of the Desktop

Recommended Posts

Zimans    237
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

Share this post


Link to post
Share on other sites
DDSquad    122
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)

Share this post


Link to post
Share on other sites
Mark Duffill    156
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

Share this post


Link to post
Share on other sites
S1CA    1418
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

Share this post


Link to post
Share on other sites
Promit    13246
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.

Share this post


Link to post
Share on other sites
Zimans    237
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

Share this post


Link to post
Share on other sites
S1CA    1418
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

Share this post


Link to post
Share on other sites