私の Android ゲームでは、OpenGL と Android NDK を使用しています。現在、Activity/GLSurfaceView から JNI ネイティブ呼び出しを行うことにより、必要な dpi 値をパラメーターとして渡しています。
現在私は使用しています:
// request an instance of DisplayMetrics, say 'dm' from android.
float densityFactor = dm.density;
// pass this as a parameter using JNI call
myCustomNativeMethod(densityFactor); # implementation in a 'game.c' file
JNIを使用せずにAndroid環境パラメータにアクセスできるかどうか疑問に思っていました(パラメータ)。UIシステムなどと直接通信するのに役立ついくつかの低レベルのNDKヘッダーファイル(.h)をインポートするようなものでしょうか?
私は次のように意味します:
#import <android_displayparams.h>
...
float densityfactor = getDisplayParamDensity(); // <- Is this possible?
注: これは好奇心からの質問であり、そのようなメカニズムが適切でない可能性があることは承知しています。