# directx 7 0 - determining current screen resolution

This topic is 3503 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Well, I finally got around to dusting off some eight year old code, originally developed under directx 7 (and earlier). I was pleasantly surprised to find it still compiles and runs under the latest directx sdk and vs2008.. I had to do little more than add '#define DIRECTINPUT_VERSION 0x700' to the source files to get things to compile. I'm using 'SetDisplayMode' to open the app full screen, exclusive. The code is an old 2D engine I wrote, since I'm using a vector definition I can scale things to any screen resolution. How can I determine the resolution of the users desktop during initialization? I want the game to open at the same resolution as the users desktop initially. I've also noticed all the 2D stuff has apparently been removed from the lastest version of directx :( Thanks, Eric

##### Share on other sites
Quote:
 Original post by onetruebooI was pleasantly surprised to find it still compiles and runs under the latest directx sdk and vs2008..
Surprising indeed - I thought they'd ditched the DX7 headers a year or so back...

Quote:
 Original post by onetruebooHow can I determine the resolution of the users desktop during initialization?
int width = GetSystemMetrics(SM_CXSCREEN);int height = GetSystemMetrics(SM_CYSCREEN);
Sufficient?

Quote:
 Original post by onetruebooI've also noticed all the 2D stuff has apparently been removed from the lastest version of directx :(
There hasn't been any new "2D-only" features in the DXSDK for around 7 years. Ever since the introduction of DirectXGraphics (aka D3D8) all graphics have been routed via Direct3D - even the 2D 'emulation' of sprites and screen-aligned quads.

Whilst its a bit more verbose you generally get much better performance and much better features from this. I was sold on the switch-over when I heard that rotation and blending were effectively free when doing 2D-in-3D. Implementing those in DirectDraw was always an unnecessary headache [headshake].

On the plus side we do now have Direct2D and DirectWrite. Can look forward to a day when GDI/GDI+ is but a mere footnote in the history books [grin]

hth
Jack

##### Share on other sites
Thank you!! That's what I was looking for.

Quote:
 Original post by jollyjeffersSurprising indeed - I thought they'd ditched the DX7 headers a year or so back...

I had to compile with an older 'dinput.h' header file (as opposed to the dinput8.h), other than that the code compiled fine.

I'm doing things from a very low level. I'm assembling the bitmap myself, and then blitting it to the screen. I wrote all the low level stuff in assembly language. Just a simple poly rasterizer (triangles and squares), with 4 or 8x supersampling (anti-aliasing). Also support for splines and radially symmetric shapes.

So the speed of the code is completely bound by the software rasterizer which is of course orders of magnitude slower than the hardware now available. Also, the speed of the blit (from system to GPU memory) plays a big part in the performance. However for simple scenes I still get acceptable (30+ fps) frame rates.

Now I see MS is already doing this with Direct2D (sigh).

Oh well, I'm doing this for fun as I enjoy low level coding. Currently working on the physics part of things.

1. 1
2. 2
3. 3
4. 4
frob
15
5. 5

• 14
• 12
• 20
• 12
• 13
• ### Forum Statistics

• Total Topics
632152
• Total Posts
3004470

×