mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-04 02:47:39 +00:00
Fixed bug 3235 - Make the Android window creation similar to iOS' window creation
Sylvain Here's a patch. It tries to get the hint first. Resizable will allow any orientation. Otherwise it uses width/height window. setOrientation method is splitted in static and non-static, so that it can be overloaded in a user subclass. Some artefact observed : surfaceChanged() can be called twice at the beginning. When the phone starts in portrait and run a landscape application.
This commit is contained in:
parent
6ef1a25d18
commit
6ee661398d
4 changed files with 72 additions and 0 deletions
|
@ -636,6 +636,18 @@ void Android_JNI_SetActivityTitle(const char *title)
|
|||
}
|
||||
}
|
||||
|
||||
void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint)
|
||||
{
|
||||
jmethodID mid;
|
||||
JNIEnv *mEnv = Android_JNI_GetEnv();
|
||||
mid = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,"setOrientation","(IIZLjava/lang/String;)V");
|
||||
if (mid) {
|
||||
jstring jhint = (jstring)((*mEnv)->NewStringUTF(mEnv, (hint ? hint : "")));
|
||||
(*mEnv)->CallStaticVoidMethod(mEnv, mActivityClass, mid, w, h, (resizable? 1 : 0), jhint);
|
||||
(*mEnv)->DeleteLocalRef(mEnv, jhint);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool Android_JNI_GetAccelerometerValues(float values[3])
|
||||
{
|
||||
int i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue