Sign in to follow this  
SLy2097

Anti-aliasing of windowed graphics (DirectDraw)

Recommended Posts

wondered is someone could help me with this. I have followed the 2d direct draw tutorial (http://www.gamedev.net/reference/articles/article608.asp) and have my game running windowed now, but it appears to be anti-aliased all the time. I am loading a 256 colour bitmap, but displaying onto a 32-bit display, dont know if this would cause windows to anti-alias. NOTE: My gfx card is set to 'application specific' for anti-aliasing. It looks kinda cool, but I would like to have control over it :) appreciate any help anyone can give.

Share this post


Link to post
Share on other sites
Any chance of a screenshot? Are you displaying the image at the same size it's loaded at, I.e. no resizing? Is your backbuffer the same size as your client area size (Not window size, which is what you pass into CreateWindow)?

Share this post


Link to post
Share on other sites
sorry for the delay in responding to this.

Screenshot: -


http://www.slyproductions.net/images/scf_aa.bmp


Thanks for your help, read your post again and it clicked: I have realised what mistake I made, I didnt take into account the extra 25 pixels height, and 6 width when creating the window.

Cheers
Ryan

Share this post


Link to post
Share on other sites
Erm, I'm already seeing visions of code that has hardcoded stuff like "height -= 25". Please tell me you didn't do that? It would break really bad in systems that use different themes or are running at higher dpi.

You should use the client area like Evil Steve mentioned - GetClientRect will get you the size of the client area. If all else fails you can use GetSystemMetrics to get the width and heights of the various pieces of a window (borders, menu, title bar, etc).

Share this post


Link to post
Share on other sites
Hi Mike,

thanks for the reply. I am a little confused, as this feels a bit chicken & egg. Does GetClientRect get the rect of a window which you have already created?

I did indeed adjust the code similar to what you mentioned, adding +=25 if its running windowed. You are correct that this would fall over with different themes though.

Here is my window creation routinue:-

CreateWindowEx(NULL,
WINDOW_CLASS_NAME, // class
"Ryan Lloyd's SCF", // title
WS_CAPTION | WS_BORDER | WS_POPUP | WS_VISIBLE,
100,5, // initial x,y
winwidth, winheight, // initial width, height
NULL, // handle to parent
NULL, // handle to menu
hinstance,// instance of this application
NULL))) // extra creation parms

appreciate any help you can give with regards to setting the width/height correctly.

Cheers
Ryan

Share this post


Link to post
Share on other sites
hey thanks alot you guys, I am sorted now.

After creating the window in 1024,768, I then do (in summary): -

GetWindowRect()
AdjustWindowRectEx()
SetWindowPos()

at the client area within is correctly sett o 1024,768.

Cheers

Ryan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this