mirror of
https://github.com/XProger/OpenLara.git
synced 2025-01-29 10:38:04 +01:00
#15 fix android volume keys, remove content files (must be copied into storage/OpenLara/ level & audio folders by user)
This commit is contained in:
parent
124a66c10f
commit
904aa2de49
Binary file not shown.
@ -6,7 +6,7 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "com.xproger.openlara"
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 25
|
||||
targetSdkVersion 18
|
||||
versionCode 1
|
||||
versionName "0.1"
|
||||
ndk {
|
||||
@ -35,5 +35,5 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
}
|
||||
|
@ -35,10 +35,11 @@ JNI_METHOD(void, nativeInit)(JNIEnv* env, jobject obj, jstring contentDir, jstri
|
||||
Stream::contentDir[0] = Stream::cacheDir[0] = 0;
|
||||
|
||||
str = env->GetStringUTFChars(packName, NULL);
|
||||
/*
|
||||
Stream *level = new Stream(str);
|
||||
env->ReleaseStringUTFChars(packName, str);
|
||||
level->seek(levelOffset);
|
||||
|
||||
*/
|
||||
str = env->GetStringUTFChars(contentDir, NULL);
|
||||
strcat(Stream::contentDir, str);
|
||||
env->ReleaseStringUTFChars(contentDir, str);
|
||||
@ -47,7 +48,7 @@ JNI_METHOD(void, nativeInit)(JNIEnv* env, jobject obj, jstring contentDir, jstri
|
||||
strcat(Stream::cacheDir, str);
|
||||
env->ReleaseStringUTFChars(cacheDir, str);
|
||||
|
||||
Game::init(level);
|
||||
Game::init();
|
||||
|
||||
lastTime = getTime();
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.os.Environment;
|
||||
import android.view.InputDevice;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
@ -65,9 +66,10 @@ public class MainActivity extends Activity implements OnTouchListener, OnKeyList
|
||||
try {
|
||||
String packName = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_ACTIVITIES).applicationInfo.sourceDir;
|
||||
// hardcoded demo level and music
|
||||
AssetFileDescriptor fLevel = this.getResources().openRawResourceFd(R.raw.level2);
|
||||
//AssetFileDescriptor fLevel = this.getResources().openRawResourceFd(R.raw.title);
|
||||
|
||||
wrapper.onCreate(System.getenv("EXTERNAL_STORAGE") + "/OpenLara/", getCacheDir().getAbsolutePath() + "/", packName, (int)fLevel.getStartOffset());
|
||||
String content = Environment.getExternalStorageDirectory().getAbsolutePath(); // System.getenv("EXTERNAL_STORAGE")
|
||||
wrapper.onCreate(content + "/OpenLara/", getCacheDir().getAbsolutePath() + "/", packName, 0);//(int)fLevel.getStartOffset());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
finish();
|
||||
@ -168,7 +170,10 @@ public class MainActivity extends Activity implements OnTouchListener, OnKeyList
|
||||
case KeyEvent.KEYCODE_BUTTON_THUMBR : btn = -9; break;
|
||||
case KeyEvent.KEYCODE_BUTTON_L2 : btn = -10; break;
|
||||
case KeyEvent.KEYCODE_BUTTON_R2 : btn = -11; break;
|
||||
case KeyEvent.KEYCODE_BACK : btn = KeyEvent.KEYCODE_ESCAPE; break;
|
||||
case KeyEvent.KEYCODE_BACK : btn = KeyEvent.KEYCODE_TAB; break;
|
||||
case KeyEvent.KEYCODE_VOLUME_UP :
|
||||
case KeyEvent.KEYCODE_VOLUME_DOWN :
|
||||
case KeyEvent.KEYCODE_VOLUME_MUTE : return false;
|
||||
default : btn = keyCode;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user