Dear all,
in order to display high-quality true-type fonts etc., my App window
must map to the physical pixels exactly.
Unfortunately, Google seems to do everything possible to keep the native
resolution a secret, including making false claims in the documentation.
So when I create a device with resolution WVGA854 (480x854 pixels) in
the Android emulator, Android reports to SDL that the screen resolution
is actually 320x519, so SDL creates a window and corresponding texture
with 320x519 pixels. When updating the screen, the texture is scaled by
a factor 1.5 to 480x778 (the remaining 76 vertical pixels (854-778) are
used by the status bar + application name), and all fonts etc. look ugly.
So far, I googled for hours, all attempts to get the real display
resolution failed.
I used for example:
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
Log.v(“Metrics”, “widthPixels=”+metrics.widthPixels);
Log.v(“Metrics”, “heightPixels=”+metrics.heightPixels);
Log.v(“Metrics”, “xdpi=”+metrics.xdpi);
Log.v(“Metrics”, “ydpi=”+metrics.ydpi);
This gives:
V/Metrics ( 1326): widthPixels=320
V/Metrics ( 1326): heightPixels=569
V/Metrics ( 1326): xdpi=160.0
V/Metrics ( 1326): ydpi=160.0
(note that heightPixels is without status bars now)
I also tried:
Log.v(“SDL”, “getWidth:”+getWindowManager().getDefaultDisplay().getWidth());
Log.v(“SDL”,
“getHeight:”+getWindowManager().getDefaultDisplay().getHeight());
This yields the same result:
V/SDL ( 1450): getWidth:320
V/SDL ( 1450): getHeight:569
In short, does anyone have an idea how to determine the real display
resolution and get crispy, unscaled graphics on screen?
Many thanks,
Elmar