Geeks With Blogs
Tex-blog Mobile and other stuff

Recently I was testing my Jawbreaker clone game (http://strony.aster.pl/marcinj/prg/balls/balls.html), on my moms laptop with Windows Vista platform to verify that it works properly. This game was developed under Windows XP (C++, MFC), so I thought there should be no problems. After running it everything looked wrong, by that I mean that all controls were at wrong positions and actually I was unable to play my game. At first I thought that this should be some Vista thing, and since I had no access to computer with that system I thought that this problem will be very difficult to solve.

First thing I have done, was downloading Microsoft Windows Vista 30-Day Eval VHD, which allowed me to run Vista system from inside my Windows XP. To my amazement my game worked properly. After some more thinking and googling I found very interesting article „The Windows Vista Developer Story: Application Compatibility Cookbook” (http://www.microsoft.com/indonesia/msdn/appcomp.aspx), In section called „High DPI Scaling” it explains that non DPI aware applications might behave improperly under Windows Vista, which is actually true also for Windows XP. After reading it I realized that I tested my game on computer with different DPI than the one I was developing with. On my WinXP I have 96 dpi. After changing DPI on my system I encountered same errors with controls positioning as I had on laptop with Vista system.

My solution was to make game look good in other than 96dpi systems and playable. Article “How to Write High-DPI Applications” (http://msdn2.microsoft.com/en-us/library/ms969894.aspx) explains how to program DPI aware applications. Actually to make my game fully DPI aware I would have to either scale all of the game bitmaps with the risk of loosing their quality or simply to make sure that all control positioning is being made in pixels instead of DLU’s (those are explained in above article). First choice would require probably composing different bitmaps for various DPI values which would be very time consuming, so I choose second approach. Its not best approach because it makes my application more difficult to use by some users. Now I realize that DPI awareness should be implemented from the very beginning of application writing.

Posted on Sunday, September 9, 2007 11:24 AM | Back to top


Comments on this post: DPI awareness

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Martinez | Powered by: GeeksWithBlogs.net