Sign in to follow this  
bcsoft

Window setup in PopCap framework

Recommended Posts

Any Popcap framework gurus out there? I used the popcap framework for my recent game release a couple months ago and I've been getting reports back that the graphics look pretty bad. It sounds like there's some funky things going on with the window creation and scaling on the variety of displays out there. My window also failed various testing having too low of a dpi for some portals and upcoming windows 7 requirements. I'm wondering if there's any popcap framework gurus out there who've run into the same thing, and already reworked the window setup and can suggest some adjustments to me. I've haven't had need to look at it until now, and there appears to be some wacky code here (and hardcoded numbers which always sets off a red flag) that doesn't make a lot of sense to me (though I have a history of console programming so I'm not a PC pro). Here's what it looks like: DWORD aWindowstyle = WS_CLIPCHILDREN | WS_POPUP | WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; if (mEnableMaximizeButton) aWindowstyle |= WS_MAXIMIZEBOX; RECT aRect; aRect.left = 0; aRect.top = 0; aRect.right = mWidth; aRect.bottom = mHeight; //GetSystemMetrics() ??? BOOL worked = AdjustWindowRect(&aRect, aWindowstyle, FALSE); int aWidth = aRect.right - aRect.left; int aHeight = aRect.bottom - aRect.top; // Get the work area of the desktop to allow us to center RECT aDesktopRect; ::SystemParametersInfo(SPI_GETWORKAREA, NULL, &aDesktopRect, NULL); int aPlaceX = 64; int aPlaceY = 64; if (mPreferredX != -1) { aPlaceX = mPreferredX; aPlaceY = mPreferredY; int aSpacing = 4; if (aPlaceX < aDesktopRect.left + aSpacing) aPlaceX = aDesktopRect.left + aSpacing; if (aPlaceY < aDesktopRect.top + aSpacing) aPlaceY = aDesktopRect.top + aSpacing; if (aPlaceX + aWidth >= aDesktopRect.right - aSpacing) aPlaceX = aDesktopRect.right - aWidth - aSpacing; if (aPlaceY + aHeight >= aDesktopRect.bottom - aSpacing) aPlaceY = aDesktopRect.bottom - aHeight - aSpacing; } if (CheckFor98Mill()) { mHWnd = CreateWindowExA( 0, "MainWindow", SexyStringToStringFast(mTitle).c_str(), aWindowstyle, aPlaceX, aPlaceY, aWidth, aHeight, NULL, NULL, gHInstance, 0); } else { mHWnd = CreateWindowEx( 0, _S("MainWindow"), mTitle.c_str(), aWindowstyle, aPlaceX, aPlaceY, aWidth, aHeight, NULL, NULL, gHInstance, 0); } Any suggestions? Thanks! -Bryce

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