- Online Community Forums » Programming Questions » Getting device resolution on Android

This thread is locked; no one can reply to it. rss feed Print
Getting device resolution on Android
Member #14,982
March 2013

I'm implementing an Android version of my game Blastonaut and i've run into an issue:

DeviceScreenWidth/Height are both zeros on Android.
If i set them manually, the program works fine.
The same code works flawlessly on Windows and iOS.

Heres the code:

al_get_monitor_info(0 , &mInfo);
int DeviceScreenWidth = mInfo.x2 - mInfo.x1;
int DeviceScreenHeight = mInfo.y2 - mInfo.y1;

// Portrait mode
gameDisplay = al_create_display(DeviceScreenHeight, DeviceScreenWidth);

P.S. I'm testing on a Galaxy S4.

Go to: